我正在尝试使用Android Studio在我的手机上安装超级强大的示例应用程序,但它没有得到构建。它显示一个错误:
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添加到当前应用程序。提前谢谢。
发布于 2016-03-02 12:45:44
只是遇到了同样的问题。通过输入“文件->项目结构”解决了这个问题。在我的例子中,"Android NDK location“是空的,如下所示。点击“选择”修复它。

发布于 2016-03-01 09:24:18
打开local.properties。将ndk.dir设置为ndk文件夹。
发布于 2016-11-25 13:58:04
只需添加
ndk.dir=
使用local.properties中的ndk文件夹
https://stackoverflow.com/questions/35392056
复制相似问题