Question

I have downloaded and installed the ndk (android-ndk-r9d) here C:\Program Files (x86)\Android\android-ndk-r9d

I have added the ndk.dir property in local.properties:

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

I have confirmed ndk-build is in the directory linked

I have confirmed my build.gradle property is appropriate (version wise)

dependencies {
    classpath 'com.android.tools.build:gradle:0.9.+'
}

I have confirmed my version of Android Studio is correct: 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)
Was it helpful?

Solution

Looks like the environment path and the local.properties files are pointing to different locations:

PATH: C:\Program Files (x86)\Android\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

OTHER TIPS

I had a similar problem to realise only that just the NDK was not installed (same error message).

I simply went to the SDK Manager in Android and installed NDK bundle.

Post that I just selected the default path in the settings and it worked.

Install NDK in your SDK manager, if you already installed open app's "build.gradle" replace these lines

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
    } 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top