In mid-December last year, GO has officially supported the Android platform! Although, at present, only preliminary support, the corresponding development is still tight shelomith drum in progress. But still can't resist the impulse to try one. The code of Go is now called through the JNI interface of Java, and the Code of Go will be compiled into so dynamic library, which will be included in the APK when compiling. below to see how to compile the Go code on the Android platform.
Download the code from the downloaded connection first:
Https://github.com/golang/mobile
Because the development environment of Go for Android is currently in trouble, the go for Android developer has provided us with a Docker image (Docker installation can refer to "Docker Usage Summary") and can be downloaded using the following command:
Docker Pull Golang/mobile
To run the mobile container:
Docker run-it--rm-v/home/my/go/mobile-master:/go_mobile Golang/mobile/bin/bash
This assumes that the path to the downloaded go for Android code is:/home/my/go/mobile-master, which will allude/home/my/go/mobile-master to the container's/go_mobile directory.
Next in $GOROOT/src/golang.org/x/create the/go_mobile symbol to connect the mobile
Mkdir-p $GOROOT/src/golang.org/xln-s/go_mobile $GOROOT/src/golang.org/x/mobile
Compile the Libhello sample code:
CD $GOROOT/src/golang.org/x/mobile/example/libhello./make.bash
To connect to a device:
ADB Connect xx.xx.xx.xx
Installation:
ADB install bin/hello-debug.apk
The next step is to run.
Summary: Now go for Android only do the go code on the Android platform simple run, want to really use go on Android platform like game development, and so on, there is much work to do.
Go for Android compilation guide