user4683997
user4683997

Reputation:

NDK is not configured issue in android studio

My Application is built successfully on Eclipse but fails to Build on android studio. It returns the error code Ndk is not Configured. Then I've added ndk path to build.gradle then its showing the following error:

Information:Gradle tasks [:nano:assembleDebug]
WARNING [Project: :nano] Current NDK support is deprecated.  Alternative will be provided in the future.
:nano:preBuild UP-TO-DATE
:nano:preDebugBuild UP-TO-DATE
:nano:compileDebugNdk
make.exe: *** No rule to make target `C:\Users\admin\nano\nano\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/la_audio_processing_android/C_\Users\admin\nano\nano\src\main\jni', needed by `C:\Users\admin\nano\nano\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/la_audio_processing_android/C_\Users\admin\nano\nano\src\main\jni\LA_PostProcessing.o'.  Stop.
Error:Execution failed for task ':nano:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\admin\AppData\Local\Android\ndk\ndk-build.cmd'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 3.449 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

Upvotes: 43

Views: 116430

Answers (10)

Yu Zhang
Yu Zhang

Reputation: 1222

Android Studio Iguana | 2023.2.1 RC 1

Step1: download NDK version which project need

enter image description here

enter image description here

Step 2: change local.properties

ndk.dir=/Users/xxx/Library/Android/sdk/ndk/21.1.6352462

Upvotes: 0

ali6p
ali6p

Reputation: 1763

In some cases, you need to point exact version of ndk version on the local.properties file like that:

ndk.dir=/Users/ali6p/Library/Android/sdk/ndk/21.3.6528147

If you need to install a specific version of ndk bundle, open Android Studio preferences and install the version (Preferences > Appearance & Behaviour > System Settings > Android SDK > SDK Tools: Show Package Details > NDK (Side by side): check the version:

Android studio preferences to install ndk version

Upvotes: 4

Florian K
Florian K

Reputation: 2148

Maybe the NDK is not installed. If it's the case, go to SDK Manager (top-right icon). Go to Android SDK > SDK Tools Check NDK (Side by side) and install it.

enter image description here

Upvotes: 0

Chaman Panchal
Chaman Panchal

Reputation: 77

In build.gradle use

android {
  ndkVersion '21.1.6352462' 
}

and use android.useDeprecatedNdk=true in gradle.properties

Upvotes: 8

Shiv Buyya
Shiv Buyya

Reputation: 4130

Go to option File->Project Structure

enter image description here

Select SDK Location->Android NDK Location and choose NDK listed in dropdown

enter image description here

Upvotes: 39

TheIT
TheIT

Reputation: 12219

My issue was caused by the target file not being found (in my case, a git sub-module needed to be checked out), so ensure all the referenced files exist on the specified path.

Upvotes: 0

Cletus Ajibade
Cletus Ajibade

Reputation: 1590

Goto Files -> Project Structure -> SDK Location

Android NDK Location is at the bottom right of the window.

Upvotes: 13

Keo Malope
Keo Malope

Reputation: 1015

For whatever reason, setting ndk.dir on the properties file is not working for me. However, setting/exporting the variable ANDROID_NDK_HOME prior to launching android studio did the trick.

Bash syntax (paths below are specific to my installation)

export ANDROID_HOME=/opt/android-sdk-linux
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle

Environment

Ubuntu Linux x64/GNU bash, version 4.4/Android Studio 2.2.3

Upvotes: 15

V Jayakar Edidiah
V Jayakar Edidiah

Reputation: 976

This is the problem faced by Android studio users in Windows environment. First for NDK not Configured problem

Go to local.properties file and give ndk path... for ex :

#Wed Mar 18 14:10:33 IST 2015
sdk.dir=C\:\\Users\\admin\\AppData\\Local\\Android\\sdk1
ndk.dir=C\:\\Users\\admin\\AppData\\Local\\Android\\ndk

Then for the Next Problem or Error...

Goto JNI Folder and create an empty c file by any name... Then your problem will be solved...

Some Quick links about this are http://ph0b.com/android-studio-gradle-and-ndk-integration/ And https://code.google.com/p/android/issues/detail?id=66937

Upvotes: 56

I use Android Studio 1.4.1.

Below is my local.properties

ndk.dir=C:\Users\BestQ\AppData\Local\Android\Sdk\ndk-bundle sdk.dir=C:\Users\BestQ\AppData\Local\Android\Sdk

It work well.

Upvotes: 10

Related Questions