Gomobile command error "No NDK path for Android"

I use Go version 1.7.5 on Windows, and when I try to use the gomobile command to install or link or build. It displays this error, "gomobile: NDK nickname for Android is not installed. Run gomobile init with the ndk package installed via the Android SDK manager or with the -ndk flag." I added the NDK path to the $ PATH system variable and even set the NDK manually, but still the error persists. Thank you for your time!

+5
source share
1 answer

You need to set the NDK path in gomobile init using the -ndk flag - if you follow these instructions , the path should be ~/Library/Android/sdk/ndk-bundle/ :

 gomobile init -ndk ~/Library/Android/sdk/ndk-bundle/ 

Then you can compile the APK:

 gomobile build -target=android <PATH> 

The path should be relative to $GOPATH/src . For example, if you install a basic example:

 go get -d golang.org/x/mobile/example/basic 

The build command should be:

 gomobile build -target=android golang.org/x/mobile/example/basic 
+6
source

Source: https://habr.com/ru/post/1264664/


All Articles