NDK is not configured issue in android studio
Asked Answered
M

10

43

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
Maypole answered 18/3, 2015 at 13:5 Comment(1)
Post your build.gradle file.Repeal
P
55

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

Palliate answered 19/3, 2015 at 6:22 Comment(3)
A Linux Mint 17 problem as well.Ambush
my local.properties looks like this on osx (Android Studio) - Flutter Project: sdk.dir=/Users/USERNAME/Library/Android/sdk ndk.dir=/Users/USERNAME/Library/Android/sdk/ndkConsumable
and this when using older NDK version ndk.dir=/Users/USERNAME/Library/Android/sdk/ndk-bundleConsumable
H
39

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

Hermosa answered 14/3, 2020 at 11:29 Comment(4)
This resolved my problem on MacOS (Catalina) - thanks!Wentz
well what if android ndk location is greyed and is not availableJonasjonathan
It was grayed for me too. I fixed the problem by adding ndk.dir=/Users/myusername/Library/Android/sdk/ndk/22.1.7171670 to my local.properties fileDiacid
For the "no platforms error": #56229322Puleo
K
15

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
Kokoruda answered 1/2, 2017 at 0:43 Comment(0)
R
13

Goto Files -> Project Structure -> SDK Location

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

Registration answered 27/9, 2017 at 12:15 Comment(0)
W
10

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.

Weinrich answered 19/12, 2015 at 11:26 Comment(0)
H
8

In build.gradle use

android {
  ndkVersion '21.1.6352462' 
}

and use android.useDeprecatedNdk=true in gradle.properties

Hypoxanthine answered 10/6, 2021 at 7:24 Comment(0)
I
3

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

Ivey answered 20/10, 2022 at 23:24 Comment(0)
F
0

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.

Fumarole answered 14/6, 2018 at 21:26 Comment(0)
M
0

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

Miscegenation answered 22/3, 2022 at 11:56 Comment(0)
I
0

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

Innsbruck answered 11/5 at 9:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.