简体   繁体   English

Java android找不到方法ndk()

[英]Java android Could not find a method ndk ()

I use a android studio And when I refresh all gradle project in console I have : 我使用一个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:\Users\ElteGps 022\Desktop\PairingCodes\app\build.gradle">Open File</a>

And in messages I see : 在邮件中,我看到:

could not find method ndk() for arguments 找不到方法ndk()作为参数

This is my build.gradle 这是我的build.gradle

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "smok.pl.pairingcodes"
        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')

}

Add ndk inside defaultConfig 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"
 }
}

Edit 编辑

You can read more here in Specify ABIs point 你可以阅读更多在这里指定的ABI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM