文章标题

来源:互联网 发布:油汀电热膜哪个好 知乎 编辑:程序博客网 时间:2024/04/30 10:22

Error:Execution failed for task ‘:app:buildNative’. > A problem occurred starting process ‘command ‘C:\NDK/ndk-build”


运行有native库调用的项目,出现该错,原build文件中,task代码如下

task buildNative(type: Exec, description: 'Compile JNI source via NDK') {        def ndkDir = android.ndkDirectory        commandLine "$ndkDir/ndk-build",                '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source                '-j', Runtime.runtime.availableProcessors(),                'all',                'NDK_DEBUG=0'    }    task cleanNative(type: Exec, description: 'Clean JNI object files') {        def ndkDir = android.ndkDirectory        commandLine "$ndkDir/ndk-build",                '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source                'clean'    }

因为windows操作环境下, commandLine “ndkDir/ndkbuild",commandLine"ndkDir/ndk-build.cmd”,修改后代码如下:

task buildNative(type: Exec, description: 'Compile JNI source via NDK') {        def ndkDir = android.ndkDirectory        commandLine "$ndkDir/ndk-build.cmd",                '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source                '-j', Runtime.runtime.availableProcessors(),                'all',                'NDK_DEBUG=0'    }    task cleanNative(type: Exec, description: 'Clean JNI object files') {        def ndkDir = android.ndkDirectory        commandLine "$ndkDir/ndk-build.cmd",                '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source                'clean'    }
0 0
原创粉丝点击