ndkBuild脚本运行

    xiaoxiao2021-04-17  36

    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 cleanNative def 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去掉即可。

    转载请注明原文地址: https://ju.6miu.com/read-673984.html

    最新回复(0)