0

I have problem with my android project which I move from one computer to another. Of course everything works fine before I change computer and Android Studio version (from 1.5 to 2.2). Now when I want to run project I have this error:

Error:Execution failed for task ':app:ndkBuild'. Process 'command 'e:\Android\ndk\android-ndk-r12b\ndk-build.cmd'' finished with non-zero exit value 2

Here my gradle build:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.xxx.crossexample"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        sourceSets.main {
            jniLibs.srcDir 'src/main/libs'
            jni.srcDirs = []
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

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

    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'

}

And my local.properies

sdk.dir=e\:\\Android\\sdk
ndk.dir=e\:\\Android\\ndk\\android-ndk-r12b

Any suggestions what is wrong with my code?

UPDATE This is gradle console log:

> Executing tasks: [:app:clean, :app:generateDebugSources,
> :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies,
> :app:generateDebugAndroidTestSources, :app:assembleDebug]
> 
> Configuration on demand is an incubating feature. Incremental java
> compilation is an incubating feature. :app:clean
> :app:buildInfoDebugLoader :app:preBuild UP-TO-DATE :app:preDebugBuild
> UP-TO-DATE :app:checkDebugManifest
> :app:prepareComAndroidSupportAnimatedVectorDrawable2320Library
> :app:prepareComAndroidSupportAppcompatV72320Library
> :app:prepareComAndroidSupportSupportV42320Library
> :app:prepareComAndroidSupportSupportVectorDrawable2320Library
> :app:prepareDebugDependencies :app:compileDebugAidl
> :app:compileDebugRenderscript :app:generateDebugBuildConfig
> :app:generateDebugResValues :app:generateDebugResources
> :app:mergeDebugResources :app:processDebugManifest
> :app:processDebugResources :app:generateDebugSources
> :app:mockableAndroidJar UP-TO-DATE :app:preDebugUnitTestBuild
> UP-TO-DATE :app:prepareDebugUnitTestDependencies
> :app:preDebugAndroidTestBuild UP-TO-DATE
> :app:prepareDebugAndroidTestDependencies
> :app:compileDebugAndroidTestAidl :app:processDebugAndroidTestManifest
> :app:compileDebugAndroidTestRenderscript
> :app:generateDebugAndroidTestBuildConfig
> :app:generateDebugAndroidTestResValues
> :app:generateDebugAndroidTestResources
> :app:mergeDebugAndroidTestResources
> :app:processDebugAndroidTestResources
> :app:generateDebugAndroidTestSources
> :app:incrementalDebugJavaCompilationSafeguard :app:ndkBuild make:
> Entering directory
> `E:/AndroidStudioProjects/CrossExample/CrossExample/app/src/main/jni'
> 
> make: *** No rule to make target
> `E:/AndroidStudioProjects/CrossExample/app/src/main/jni/SuperpoweredExample.cpp',
> needed by
> `E:/AndroidStudioProjects/CrossExample/CrossExample/app/src/main/obj/local/arm64-v8a/objs/SuperpoweredExample/E_/AndroidStudioProjects/CrossExample/app/src/main/jni/SuperpoweredExample.o'.
> Stop.
> 
> make: Leaving directory
> `E:/AndroidStudioProjects/CrossExample/CrossExample/app/src/main/jni'
> :app:ndkBuild FAILED
> 
> FAILURE: Build failed with an exception.
> 
> * What went wrong: Execution failed for task ':app:ndkBuild'.
> > Process 'command 'e:\Android\ndk\android-ndk-r11c\ndk-build.cmd'' finished with non-zero exit value 2
> 
> * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
> 
> BUILD FAILED
> 
> Total time: 7.778 secs
MaSza
  • 435
  • 7
  • 22

1 Answers1

2

In my case running builds from command line was working, but not from the gui. I solved this by upgrading the Android Build tools. Maybe the NDK was not compatible with the Android Build tools I had before.

ReSearchIT Eng
  • 111
  • 1
  • 3