Golang Gomobile Environment Construction

Source: Internet
Author: User

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

    1. Select the NDK package that matches the operating system and number of bits: https://developer.android.google.cn/ndk/downloads/index.html
    2. 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

  




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.