John Code
John Code

Reputation: 685

Can't Configure NDK path on android studio

I have an android studio project which requires the NDK to be set. I had downloaded an NDK manually and extracted it to a directory in my C: drive. What I did was to follow the instructions which are online and I went to : File->Project structure, and tried to set the NDK path. But the search box there was disabled as shown in the image,

enter image description here

I then set environment variables to point where the ndk was located. Here are the names I used for the environment variables: "ANDROID_NDK_ROOT" and later "ANDROID_NDK_HOME" when the former didn't work.

So I clicked on the Download button below the disabled search box. After letting android studio do its thing and download another NDK, I restarted android studio, just find out that the search box was disabled, and I couldn't set the NDK path.

Then I went to SDK Manager -> SDK Tools -> I checked the android NDK and CMAKE, then waited for it to download.

But after downloading again, android studio still couldn't find the NDK. I set the environment variables and even restarted my PC.

This thing is extremely frustrating, what the hell have I done wrong ? Please can someone tell me ?

Upvotes: 2

Views: 2723

Answers (2)

Shivani Verma
Shivani Verma

Reputation: 31

Android->local.properties and add ndk version

Users\PC\AppData\Local\Android\Sdk\ndk\ndkversion

for mac users -

/Users/starka/Library/Android/sdk/ndk/24.0.8215888

In order to download desired ndk version in android studio, go to tools->sdk manager->sdk tools (enable show package details) -> NDK and download the desired version.

Upvotes: 0

Shahryar Ahmed
Shahryar Ahmed

Reputation: 307

Open local.properties and add

ndk.dir=C:\Users\PC\AppData\Local\Android\Sdk\ndk\ndkversion

download ndk if previously not exist in directory

https://developer.android.com/ndk/downloads

Upvotes: 3

Related Questions