我已经坚持这个问题2天了,并尝试了stackoverflow上给出的所有可能的解决方案.下面是我的build.gradle文件:
apply plugin: 'com.androID.application'androID { compileSdkVersion 25 buildToolsversion "25.0.3" sourceSets.main.jni.srcDirs = [] sourceSets.main.jnilibs.srcDir 'src/main/libs'defaultConfig { applicationID "com.example.anannyauberoi.testingcam" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionname "1.0" ndk { modulename "app" cFlags "-std=c++11 -fexceptions" ldlibs "log" stl "gnustl_shared" abiFilter "armeabi-v7a" }}buildTypes { release { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' }}sourceSets { main { jni.srcDirs = [] res.srcDirs = ['src/main/res'] jnilibs.srcDirs=['src/main/libs']} }//sourceSets.main.jni.srcDirs = []// disable automatic ndk-build call, which ignore our AndroID.mktask ndkBuild(type: Exec, description: 'Compile JNI source via NDK') { commandline "C:/Users/Anannya-Uberoi/AppData/Local/AndroID/sdk/ndk-bundle/ndk-build.cmd", 'NDK_PROJECT_PATH=build/intermediates/ndk', 'NDK_liBS_OUT=src/main/jnilibs', 'APP_BUILD_SCRIPT=src/main/jni/AndroID.mk', 'NDK_APPliCATION_MK=src/main/jni/Application.mk'}tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild}tasks.all { task -> if (task.name.startsWith('compile') && task.name.endsWith('Ndk')) { task.enabled = false }}// call regular ndk-build(.cmd) script from app directory} //Modify the below set of code to the ndk-build.cmd location in your computer.dependencIEs { compile filetree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.androID.support:appcompat-v7:25.3.1' compile project(':openCVlibrary249')}
我已经尝试了所有可能的解决方案 – 删除build文件夹中的obj文件夹,尝试通过设置sourceSets.main来避免自动AndroID.mk调用,试图避免调用compileDeBUGNdk任务.我也没有任何cmake.txt文件.我似乎无法克服这个问题.
我使用过AndroID Studio 2.3.2和2.1.1,这两个问题都存在.
任何帮助,将不胜感激.
解决方法:
你应该使用最新的AndroID Studio,2.3.2就行了.它在androID gradle插件中集成了externalNativeBuild,因此您不需要使用自定义gradle任务的技巧.
我实际上无法测试下面的build.gradle脚本,所以请原谅我任何错别字:
apply plugin: 'com.androID.application'androID { compileSdkVersion 25 buildToolsversion "25.0.3"defaultConfig { applicationID "com.example.anannyauberoi.testingcam" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionname "1.0" externalNativeBuild { ndkBuild { targets "app" cppFlags "-std=c++11 -fexceptions" arguments "APP_STL=gnustl_shared" abiFilters "armeabi-v7a" } }}buildTypes { release { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' }}sourceSets { main { res.srcDirs = ['src/main/res']} }externalNativeBuild { ndkBuild { path "src/main/jni/AndroID.mk" }} //Modify the below set of code to the ndk-build.cmd location in your computer.dependencIEs { compile filetree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.androID.support:appcompat-v7:25.3.1' compile project(':openCVlibrary249')}
总结 以上是内存溢出为你收集整理的android – ‘:app:ndkBuild’的执行失败.进程’命令ndk-build.cmd’以非零退出值2结束全部内容,希望文章能够帮你解决android – ‘:app:ndkBuild’的执行失败.进程’命令ndk-build.cmd’以非零退出值2结束所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)