I am completely new to Android development and just installed Android Studio. I\'m doing a very basic HelloGL2 exercise, and I opened up the HelloGL2.iml file. I tried runni
My version is a little bit different :
From an open project, select Tools > Android > SDK Manager from the main menu. In Appearance & behavior > System Settings > Android SDK I have to Click the SDK Tools tab. Check the box next to NDK Click apply
For above Android Studio 4.0, paste this in local.properties
:
ndk.dir=C\:\\Users\\USER\\AppData\\Local\\Android\\Sdk\\ndk\\21.3.6528147
I double-checked that I already had the latest NDK installed (so that wasn't the solution for me). Next I did the following: Android Studio Menu -> File -> Project structure -> SDK Location. Here, no NDK was selected, so I selected the latest version. This solved the problem.
This fix only works locally for this particular machine and for this project by writing your choice to the local.properties
file in your project's root.
UPDATE: There's also a way to set this globally via ANDROID_NDK_HOME
environment variable. This is how I invoke building my project on a build server:
export ANDROID_SDK_ROOT=/home/jenkins/Android/Sdk/; export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/21.0.6113669; ./gradlew assembleRelease
if you see this error you may have not any NDK in your SDK.
so you better download it from hereand copy all folders and files in your SDK.
also you can go; open project>select tools[in upper page]>Android>SDK Manager[from main menu]>click SDK Tools tab>and check the box next to NDK
if you have not NDK in SDK Tools tab,you can download automatic in this folder
//Try this one 1 - Android Studio -> Tools -> SDK Manager -> select SDK Tools
2 - Check the boxes next to LLDB, CMake, and NDK
3 - Apply and press OK button ..
worked !!
3. now, do OK or Apply 4. Get back and click on "Install NDK '21.0.6113669' and sync project" in your failed build.
Happy coding :)