问题描述
我在Windows中使用Go版本1.7.5,并且当我尝试使用gomobile命令进行安装,绑定或构建时.它显示此错误-"gomobile:未设置Android NDK路径.请在通过Android SDK管理器安装的ndk-bundle或设置了-ndk标志的情况下运行gomobile初始化." 我已经将NDK路径添加到系统变量$ PATH中,甚至手动安装了NDK,但该错误仍然存在.谢谢你的时间!!
I am using Go version 1.7.5 in windows and when i am trying to use gomobile command either to install or bind or build . It displays this error-"gomobile: no Android NDK path is set. Please run gomobile init with the ndk-bundle installed through the Android SDK manager or with the -ndk flag set."I have added NDK path to system variable $PATH and even installed NDK manually but still the error persist.Thanks for your time !!
推荐答案
您需要使用 -ndk
标志在 gomobile init
中设置NDK路径-如果您遵循这些说明,路径应为〜/Library/Android/sdk/ndk-bundle/
:
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/
然后您可以编译APK:
Then you can compile the APK:
gomobile build -target=android <PATH>
该路径应相对于 $ GOPATH/src
.例如,如果您安装基本示例:
The path should be relative to $GOPATH/src
. For example, if you install the basic example:
go get -d golang.org/x/mobile/example/basic
build命令应为:
The build command should be:
gomobile build -target=android golang.org/x/mobile/example/basic
这篇关于gomobile命令错误"未设置android NDK路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!