我正在尝试在Android Studio中使用NDK,但会发生错误:
错误:原因:org.gradle.api.internal.ExtensibleDynamicObject
我的Android Studio版本是2.2预览版1,Gradle版本是2.10
gradle-experimental版本是0.7.0
我试过这个Gradle build Error:Cause: org.gradle.api.internal.ExtensibleDynamicObject但它不起作用
任何人都知道如何解决它?
以下是我的build.gradle文件内容:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "me.stupideme.shuclass"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
android.ndk {
moduleName "ndktest"
ldLibs.addAll(['log'])
cppFlags.add("-std=c++11")
cppFlags.add("-fexceptions")
platformVersion 16
stl 'gnustl_shared'
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles += file('proguard-rules.pro')
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'io.github.yavski:fab-speed-dial:1.0.1'
compile 'com.github.akashandroid90:imageletter:1.5'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles += file('proguard-rules.pro')
}
}
}
答案 0 :(得分:0)
minSdkVersion.apiLevel 16
targetSdkVersion.apiLevel 21
而不是
minSdkVersion 16
targetSdkVersion 21
和
moduleName = 'ndktest'
而不是
moduleName "ndktest"
应该是
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "me.stupideme.shuclass"
minSdkVersion.apiLevel 16
targetSdkVersion.apiLevel 21
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
android.ndk {
moduleName = 'ndktest'
ldLibs.addAll(['log'])
cppFlags.add("-std=c++11")
cppFlags.add("-fexceptions")
platformVersion 16
stl 'gnustl_shared'
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles += file('proguard-rules.pro')
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'io.github.yavski:fab-speed-dial:1.0.1'
compile 'com.github.akashandroid90:imageletter:1.5'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles += file('proguard-rules.pro')
}
}
}
}