且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android Studio 1.4.1错误:(15,0)未找到Gradle DSL方法:"ndk()"

更新时间:2022-03-26 21:35:05

将ndk移至defaultConfig范围.也许,您也想添加sourceSets.main范围

Move the ndk to the defaultConfig scope. Maybe, you'll want to add the sourceSets.main scope too

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.guitarv.www.ndktest"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        ndk {
            moduleName = "HelloJNI"
        }
        sourceSets.main {
            jni.srcDirs = []
            jniLibs.srcDir "src/main/libs"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}