1. Install the Go Language SDK
Https://www.golangtc.com/download
2. Configure system variables this establishes the Goroot and Gopath two directories, respectively, corresponding to the directory where the SDK resides and the project file root directory
3. Enter the success of Go version verification
4. Installing Gomobile
1) cmd Knock Command (requires CMDFQ)
get golang.org/x/mobile/cmd/gomobilegomobile init
2) git clone https://github.com/golang/mobile, after successful download, change file name to Mobile, copy to $gopath/src/golang.org/x/
If there is no file path, create it Yourself
2.1) Go build golang.org/x/mobile/cmd/gomobile, this will generate gomobile under Gopath/bin;
2.2) Execute Gomobile INIT, generate Gobind under Gopath/bin;
Gomobile init execution will not error, if there is a problem, the execution of BIND will be error;
After executing init, execute gomobile version to see if it is successful:
Copy the Gomobile,gobind, sudo cp gomobile gobind/usr/local/go/bin, and go back to the system path for Gobind when performing gomobile bind;
Download: ANDROIDNDK
- Select the NDK package that matches the operating system and number of bits: https://developer.android.google.cn/ndk/downloads/index.html
- Unzip it and put it in a directory you remember.
3) Try to compile the first Android apk install package cmd command: Gomobile build-target=android golang.org/x/mobile/example/basic
If you are prompted to "No Android NDK Path is set", you need the following code to specify the NDK path
" your ANDROIDNDK path. "
Then compile, compile successfully will put the compiled apk (%GOPATH%\SRC) install package into the directory where CMD is currently pointing