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.
go to Android Studio-> Tools -> SDK ManagerUnder SDK tools tab uncheck "NDK", "CMake", "LLDB" and then apply changes. NDK components will be removed.
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.
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.
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.
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:
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.
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.
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").
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With