This is a creation in Article, where the information may have evolved or changed.
Gomobile bind-target=android Golang.org/x/mobile/example/bind/hello
D:\go\src\golang.org\x\mobile\example\bind>gomobile bind-target=android./hello
git clone https://github.com/golang/mobile.git
3. There are two ways to develop mobile apps Golang
A. Native application development
$ go get-d golang.org/x/mobile/example/basic
Main application areas:
- application control management and configuration
- OpenGL ES 2 bindings
- Asset Management
- Event Management
- the package in the experiment contains openal bindings, audio, fonts, graphics, and motion sensors
Android Development
$ gomobile build-target=android Golang.org/x/mobile/example/basic
This command generates an APK installation package named Basic
$ gomobile Install Golang.org/x/mobile/example/basic
This command installs the APK package to the connected Android device
iOS development
$ gomobile Build-target=ios Golang.org/x/mobile/example/basic
This command generates an app installation package called Basic
Download iOS install Package command-line tool-Ios-deploy
$ ios-deploy-b Basic.app
This command installs the app file to an enabled iOS emulator or to a connected iOS device
B. Hybrid binding development
$ go get-d golang.org/x/mobile/example/bind/...
- Benefits
- Go code reuse
- share common Go code in Android and iOS development by calling the bound Golang package name
-
Restrictions
- only some go types currently supported
- binding between languages has performance overhead