android - Superpowered SDK : Error:Execution failed for task ':app:ndkBuild' . 启动进程 'command ' null/ndk-build''

标签 android android-studio android-ndk

我正在尝试使用 Android Studio 在我的手机上安装 Superpowered 示例应用程序,但它没有被构建。它显示错误:

Error:Execution failed for task ':app:ndkBuild'.
> A problem occurred starting process 'command 'null/ndk-build''

build.gradle 代码为:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.superpowered.hlsexample"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        sourceSets.main {
            jniLibs.srcDir 'src/main/libs'
            jni.srcDirs = []
        }
    }

    task ndkBuild(type: Exec) {
        Properties properties = new Properties()
        properties.load(project.rootProject.file('local.properties').newDataInputStream())
        def ndkDir = properties.getProperty('ndk.dir')
        commandLine "$ndkDir/ndk-build", '-B', '-C', file('src/main/jni').absolutePath
        // Windows users: commandLine "$ndkDir\\ndk-build.cmd", '-B', '-C', file('src/main/jni').absolutePath
    }

    lintOptions {
        abortOnError false
    }

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

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
}

请帮我找到正确的解决方案。和/或指导我如何将 NDK 添加到当前应用程序。提前致谢。

最佳答案

刚遇到同样的问题。通过输入“文件 ->项目结构”来解决它。对于我的情况,“Android NDK 位置”如图所示为空。单击“选择”修复它。 problematic screen in Android Studio

关于android - Superpowered SDK : Error:Execution failed for task ':app:ndkBuild' . 启动进程 'command ' null/ndk-build'',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35392056/

相关文章:

android - 在 OSX 的 mupdf 上运行 ndk-build 时使用哪个编译器?

java - 在 Java/Android 中,为什么我能够从 ParcelFileDescriptor 获取整数文件描述符?

android - Android 上的链接错误

android ndk 链接到 libcutils.so

android.arch.persistence.room :testing depends on Kotlin?

android - 在 android 中使用 malloc/free

Android Studio 1.0RC4 Gradle 构建错误

android - 如何将始终从特定线程调用其回调的监听器包装到符合 subscribeOn 定义的 Scheduler 的 Observable 中?

java - 尝试从共享首选项中检索数据时我遗漏了什么

android - 为 Android 创建自定义锁屏