Gradle sync failed, NDK not configured, download it with SDK manager

前端 未结 11 2831
难免孤独
难免孤独 2020-12-24 01:25

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

11条回答
  •  情歌与酒
    2020-12-24 01:34

    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
    

提交回复
热议问题