Android Studio ndk.dir 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23321680/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio ndk.dir issue
提问by Syntax
I have downloaded and installed the ndk (android-ndk-r9d) here C:\Program Files (x86)\Android\android-ndk-r9d
我已经在 C:\Program Files (x86)\Android\android-ndk-r9d 下载并安装了 ndk (android-ndk-r9d)
I have added the ndk.dir property in local.properties:
我在 local.properties 中添加了 ndk.dir 属性:
sdk.dir=C\:\Program Files (x86)\Android\android-studio\sdk
ndk.dir=C\:\Program Files (x86)\Android\android-studio\android-ndk-r9d
I have added a system environment variable:
我添加了一个系统环境变量:
ANDROID_NDK_HOME = C:\Program Files (x86)\Android\android-ndk-r9d
ANDROID_NDK_HOME = C:\Program Files (x86)\Android\android-ndk-r9d
I have confirmed ndk-build is in the directory linked
我已经确认 ndk-build 在链接的目录中
I have confirmed my build.gradle property is appropriate (version wise)
我已经确认我的 build.gradle 属性是合适的(版本明智)
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
I have confirmed my version of Android Studio is correct: 0.5.5
我已经确认我的 Android Studio 版本是正确的:0.5.5
I am still getting this:
我仍然得到这个:
Error:Execution failed for task ':muPdf:compileReleaseNdk'.
> NDK not configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties.
(On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)
回答by Sean
Looks like the environment path and the local.properties files are pointing to different locations:
看起来环境路径和 local.properties 文件指向不同的位置:
PATH:
C:\Program Files (x86)\Android\android-ndk-r9d
小路:
C:\Program Files (x86)\Android\android-ndk-r9d
local.properties: C\:\\Program Files (x86)\\Android\\android-studio\\android-ndk-r9d
local.properties: C\:\\Program Files (x86)\\Android\\android-studio\\android-ndk-r9d
Make sure which is right.
You can keep the PATH and drop the local.properties declerations,
and then try this command through the console
: ndk-build -?
to see if it was found in PATH
确定哪个是正确的。您可以保留 PATH 并删除 local.properties 声明,然后通过console
:尝试此命令ndk-build -?
以查看它是否在 PATH 中找到
回答by sampa
I had a similar problem to realise only that just the NDK was not installed (same error message).
我有一个类似的问题,只是意识到没有安装 NDK(相同的错误消息)。
I simply went to the SDK Manager in Android and installed NDK
bundle.
我只是转到 Android 中的 SDK Manager 并安装了NDK
bundle。
Post that I just selected the default path in the settings and it worked.
发布我刚刚在设置中选择了默认路径并且它起作用了。
回答by Shyam Kumar
Install NDK in your SDK manager, if you already installed open app's "build.gradle" replace these lines
在您的 SDK 管理器中安装 NDK,如果您已经安装了打开的应用程序的“build.gradle”,请替换这些行
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/', 'src/main/jni/'] } }
to
到
sourceSets.main {
jniLibs.srcDir 'src/main/jniLibs' // mention your JNI lib path(where ".so" files contains)
jni.srcDirs = [] //disable automatic ndk-build call
}