Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ANDROID_NDK_HOME so that Android Studio does not ask for ndk location?

My ndk is located at C:\Users\X\AppData\Local\Android\ndk. Now each time I create a new native android project and try to import into Android Studio, it asks me for the location of ndk. I can manually set the ndk in local.properties also.

But I am looking for a way to set this ndk path, so that Android Studio does not ask me to set this path each time.

I have already set ANDROID_NDK_HOME, as well as NDK_HOME in system environment variable on Windows 10 machine, but Android Studio is still not able to find it. I have restarted my machine as well, still no luck.

I have not tried it on mac, but your answers for both windows and mac are welcome.

like image 684
Vinayak Garg Avatar asked Aug 26 '16 06:08

Vinayak Garg


People also ask

How do I disable NDK?

go to Android Studio-> Tools -> SDK ManagerUnder SDK tools tab uncheck "NDK", "CMake", "LLDB" and then apply changes. NDK components will be removed.

Where is NDK located Android studio?

Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory. Each version is located in a subdirectory with the version number as its name.

How do you fix NDK bundle did not have a source properties File?

I had the same issue and solve it : Go to SDK location find NDK folder and check the folders if one of them is empty or corrupted delete it and let the android studio use the latest version you have. That was the working one.

How do I change the NDK location in Android Studio?

Select the menu File > Project Structure > SDK Location, Android NDK Location if it is not set yet, then click ..., and browse to your NDK location and click "OK" (you may also choose "download"). Once you set once. If will by default use the settings for Ndk location for the all your android projects too.

Where is my Android SDK located?

For example, if your Android SDK location is at C:\Users\username\AppData\Local\Android\Sdk, clear the old path in the Android SDK Locationbox, paste in this path, and click OK. In Visual Studio for Mac, navigate to Preferences > Projects > SDK Locations > Android. In the Androidpage, click the Locationstab to view and set the SDK location:

What version of NDK do I need for Android Studio?

When you install the NDK, Android Studio selects the latest available NDK. For most projects, installing this default version of the NDK is sufficient. If your project needs one or more specific versions of the NDK, though, you can download and configure specific versions.

How do I install CMake NDK on Android Studio?

Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory. To install CMake and the default NDK in Android Studio, do the following: With a project open, click Tools > SDK Manager. Click the SDK Tools tab. Select the NDK (Side by side) and CMake checkboxes.


2 Answers

1.Check the NDK Path. Select the menu File > Project Structure > SDK Location, Android NDK Location if it is not set yet, then click ..., and browse to your NDK location and click "OK" (you may also choose "download").

Snapshot for locating the above

2.To have it edit the local.properties file of your project

ndk.dir = YOUR_NDK_PATH 

Set a Environment variable for your system

ANDROID_NDK_HOME = "YOUR_PATH_TO_LOCATE_NDK_BUNDLE" 

default if you downloaded from SDK manager then it will be

"YOUR_SDK_PATH/android-sdk-windows\ndk-bundle" 

Once you set once. If will by default use the settings for Ndk location for the all your android projects too.

like image 189
Arpit Garg Avatar answered Sep 19 '22 14:09

Arpit Garg


I didn't use ndk-bundles in my Project, but got this issue anyway.

I solved it like this: Go to your sdk.dir (maybe have a look into local.properties).

If you don't use ndk, you shouldn't see an /ndk-bundle directory. If it's appear in your /sdk-Directory, look into it (should be emtpy).

Remove this ndk-bundle folder

After that, my error-messages are gone.

like image 25
suther Avatar answered Sep 20 '22 14:09

suther