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

前端 未结 11 2845
难免孤独
难免孤独 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:47

    disclaimer: I work on Android Studio

    With newer version (3.6+) of Android Gradle Plugin, please download with "NDK (Side by side)" option from the SDK manager and then specify ndkVersion in the build.gradle with the full version of NDK that is locally available from your machine.

    For example, after you downloaded NDK 20.1.5948944 under "NDK (Side by side)" from the SDK manager, the downloaded NDK would be, by default, under ~/Android/Sdk/ndk/20.1.5948944. Then in your module level build.gradle, you need something like the following.

    android {
        compileSdkVersion 29
    
    
        defaultConfig {
            // ...
        }
    
        buildTypes {
            // ...
        }
    
        externalNativeBuild {
            // ...
        }
    
        ndkVersion "20.1.5948944" // <<==== Here
    }
    

提交回复
热议问题