我使用 android studio 当我刷新控制台中的所有 gradle 项目时,我有:
Error:(28, 0) Could not find method ndk() for arguments [build_drk092k49tm2cwy3k37ev72l6$_run_closure1$_closure7@6b46899]
on object of type com.android.build.gradle.AppExtension.
<a href="openFile:C:\ app\build.gradle">Open File</a>
在消息中我看到:
找不到参数的 ndk() 方法
这是我的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxx"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
ndk {
moduleName "liblfrfid"
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
task nativeLibsToJar(type: Jar, description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
}
}
repositories {
maven { url "http://dl.bintray.com/bednarthe/maven" }
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/core-2.2.jar')
compile files('libs/jsr305-3.0.0.jar')
compile files('libs/ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar')
compile files('libs/picasso-2.3.4.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar')
}
在defaultConfig
内添加
ndk
defaultConfig {
applicationId "smok.pl.pairingcodes"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
moduleName "liblfrfid"
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
编辑
您可以在此处阅读更多内容指定 ABI 点