Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

android studio2.1.2 not build #168

Closed
sujiewen opened this issue Aug 11, 2016 · 4 comments
Closed

android studio2.1.2 not build #168

sujiewen opened this issue Aug 11, 2016 · 4 comments

Comments

@sujiewen
Copy link

// Call external ndk-build(.cmd) script to build the native code
task ndkBuild(type: Exec) {

// def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
// commandLine "ndk-build${ndkBuildExt}", '-C', file('src/main').absolutePath,
// '-j', Runtime.runtime.availableProcessors()
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine "ndk-build.cmd", '-C', file('src/main').absolutePath, '-j', Runtime.runtime.availableProcessors()
}
else {
commandLine "/Users/Sjw/Library/Android/sdk/ndk-bundle/ndk-build", '-C', file('src/main').absolutePath, '-j', Runtime.runtime.availableProcessors()
}
}

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

// Cleanup task to remove previously generated binaries
task ndkClean(type: Exec) {
    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
        commandLine "ndk-build.cmd", '-C', file('src/main').absolutePath, 'clean'
    }
    else {
        commandLine "/Users/Sjw/Library/Android/sdk/ndk-bundle/ndk-build", '-C', file('src/main').absolutePath, 'clean'
    }

// def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
// commandLine "ndk-build${ndkBuildExt}", '-C', file('src/main').absolutePath, 'clean'
}

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':tess-two:ndkClean'.

    A problem occurred starting process 'command 'ndk-build''

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

@rmtheis
Copy link
Owner

rmtheis commented Aug 11, 2016

@sujiewen Did you set the path to your NDK installation in the Project Structure dialog (File->Project Structure)?

@sujiewen
Copy link
Author

@rmtheis
Already set,See screenshot!Command line can compile。
2016-08-17 17 18 05

@rmtheis
Copy link
Owner

rmtheis commented Aug 20, 2016

Be sure to add your NDK folder to your PATH. If that does not fix it, please open a new issue with the stack trace and the complete steps needed to reproduce this.

@rmtheis rmtheis closed this as completed Aug 20, 2016
@rmtheis
Copy link
Owner

rmtheis commented Aug 21, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants