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
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