在ndk build android中找不到add-application.mk文件

在ndk build android中找不到add-application.mk文件,android,android-ndk,android-gradle-plugin,Android,Android Ndk,Android Gradle Plugin,我正在使用此链接传输声音。这是一个库,因此在project和buld.gradle中添加了它,我将项目编译为: 编译项目(':quiet') 我的build.gradle(模块:quiet)代码是 现在,当我构建我的项目时,它抛出ndk问题,如图所示 我面临的问题如图所示 第一个猜测是NDK安装已损坏。仅供参考,如果您使用的是externalNativeBuild,则不需要所有手动ndk构建任务。首先,可能是ndk安装已损坏。仅供参考,如果您使用的是externalNativeBuild,则不需

我正在使用此链接传输声音。这是一个库,因此在project和buld.gradle中添加了它,我将项目编译为:
编译项目(':quiet')

我的build.gradle(模块:quiet)代码是

现在,当我构建我的项目时,它抛出ndk问题,如图所示

我面临的问题如图所示


第一个猜测是NDK安装已损坏。仅供参考,如果您使用的是
externalNativeBuild
,则不需要所有手动ndk构建任务。首先,可能是ndk安装已损坏。仅供参考,如果您使用的是
externalNativeBuild
,则不需要所有手动ndk构建任务。
    import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }


        debug {
            debuggable = true
            jniDebuggable = true
        }
    }

    sourceSets { main {
        jniLibs.srcDir 'src/main/libs'
        jni.srcDirs = []
    } }
    externalNativeBuild{
        ndkBuild{
            path "$projectDir/src/main/jni/Android.mk"
        }
    }

}

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    androidTestCompile 'com.android.support:support-annotations:23.0.0'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'com.android.support.test:runner:0.5'
    compile 'com.android.support:appcompat-v7:23.1.1'
}

def getNdkDir() {
    if (System.env.ANDROID_NDK_ROOT != null)
        return System.env.ANDROID_NDK_ROOT

    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndkdir = properties.getProperty('ndk.dir', null)
    if (ndkdir == null)
        throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")

    return ndkdir
}

    def getNdkBuildCmd() {
    def ndkbuild = getNdkDir() + "/ndk-build"
    if (Os.isFamily(Os.FAMILY_WINDOWS))
        ndkbuild += ".cmd"

    return ndkbuild
}

    task ndkBuild(type:Exec, description: "Compile JNI Sources") {
    workingDir file('src/main')
    commandLine getNdkBuildCmd()
}

    tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn ndkLibsToJar
}

    task ndkLibsToJar(type: Zip, dependsOn: 'ndkBuild', description: 'Create a JAR of the native libs') {
    destinationDir new File(buildDir, 'libs')
    baseName 'ndk-libs'
    extension 'jar'
    from(new File(buildDir, 'libs')) { include '**/*.so' }
    into 'lib/'
}