Note: You need to have Go 1.5 or above to install mobile tools. (Or at least Go 1.7.4 if using macOS Sierra)
Go Mobile introduces a new tool, gomobile, to help you with the build and the binding process.
On OS X, you will need to have Xcode Command Line Tools installed.)
cd $GOPATH
go get golang.org/x/mobile/cmd/gomobile
(在$GOBIN/里面就会出现可执行文件
gomobile)
gomobile -h
会显示:
Gomobile is a tool for building and running mobile apps written in Go.
To install:
$ go get golang.org/x/mobile/cmd/gomobile
$ gomobile init
At least Go 1.10 is required.
For detailed instructions, see https://golang.org/wiki/Mobile.
Usage:
gomobile command [arguments]
Commands:
bind build a library for Android and iOS
build compile android APK and iOS app
clean remove object files and cached gomobile files
init build OpenAL for Android
install compile android APK and install on device
version print version
Use 'gomobile help [command]' for more information about that command.
项目地址:https://github.com/golang/go/wiki/Mobile
https://godoc.org/golang.org/x/mobile/cmd/gomobile