Reputation: 335
I am trying to install Superpowered example app on my phone using Android Studio but it's not getting built. It shows an error:
Error:Execution failed for task ':app:ndkBuild'.
> A problem occurred starting process 'command 'null/ndk-build''
build.gradle code is:
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'
}
Please help me find the right solution. And/Or guide me on how to add NDK to the current app. Thanks in Advance.
Upvotes: 3
Views: 2419
Reputation: 2896
Just had same problem. Solved it by entering "File -> Project Structure". For my case "Android NDK location" was empty as shown. Clicking "Select" fixed it.
Upvotes: 2