ndkBuild脚本运行

来源:互联网 发布:魔法王座翅膀进阶数据 编辑:程序博客网 时间:2024/04/20 11:20




task ndkBuild(type: Exec) {    workingDir file('src/main/jni')    commandLine getNdkBuildCmd()}task cleanNative(type: Exec){    workingDir file('src/main/jni')    commandLine getNdkBuildCmd(), 'clean'}clean.dependsOn cleanNativedef getNdkDir() {    if (System.env.ANDROID_NDK_ROOT != null)        return System.env.ANDROID_NDK_ROOT    Properties properties = new Properties()    properties.load(project.rootProject.file('local.properties').newDataInputStream())    def ndkdir = properties.getProperty('ndk.dir', null)    if (ndkdir == null)        throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")    return ndkdir}def getNdkBuildCmd() {    def ndkbuild = getNdkDir() + "/ndk-build"//    ndkbuild += ".cmd"    return ndkbuild}


linux下报错:

Error:Execution failed for task ':app:ndkBuild'.
> A problem occurred starting process 'command '/home/jason/Android/Sdk/ndk-bundle/ndk-build.cmd''

解决:

linux没有ndk-build.cmd

把.cmd去掉即可。

0 0