Java finished with non-zero exit value 2 - Android Gradle

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xxhongdev/article/details/51392964

解决办法:
1、将重复的module删除
2、在app的gradle中加入如下代码

defaultConfig {
          multiDexEnabled true
    }

第二种方法如对你有帮助,麻烦点赞

展开阅读全文

使用studio的编译项目的时候,报:\aapt.exe'' finished with non-zero exit value 1

04-22

弄了快一周了,还没有找到解决方案,万能的csdn。rn这是报的错误:rnInformation:Gradle tasks [:theDiamondExpress:assembleDebug]rn:easeUI:preBuild UP-TO-DATErn:easeUI:preReleaseBuild UP-TO-DATErn:easeUI:compileReleaseNdk UP-TO-DATErn:easeUI:compileLintrn:easeUI:copyReleaseLint UP-TO-DATErn:easeUI:mergeReleaseProguardFiles UP-TO-DATErn:easeUI:packageReleaseRenderscript UP-TO-DATErn:easeUI:checkReleaseManifestrn:easeUI:prepareReleaseDependenciesrn:easeUI:compileReleaseRenderscript UP-TO-DATErn:easeUI:generateReleaseResValues UP-TO-DATErn:easeUI:generateReleaseResources UP-TO-DATErn:easeUI:packageReleaseResources UP-TO-DATErn:easeUI:compileReleaseAidl UP-TO-DATErn:easeUI:generateReleaseBuildConfig UP-TO-DATErn:easeUI:generateReleaseAssets UP-TO-DATErn:easeUI:mergeReleaseAssets UP-TO-DATErn:easeUI:processReleaseManifest UP-TO-DATErn:easeUI:processReleaseResources UP-TO-DATErn:easeUI:generateReleaseSources UP-TO-DATErn:easeUI:compileReleaseJavaWithJavac UP-TO-DATErn:easeUI:processReleaseJavaRes UP-TO-DATErn:easeUI:transformResourcesWithMergeJavaResForRelease UP-TO-DATErn:easeUI:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATErn:easeUI:mergeReleaseJniLibFolders UP-TO-DATErn:easeUI:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATErn:easeUI:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATErn:easeUI:bundleRelease UP-TO-DATErn:initActivity:preBuild UP-TO-DATErn:initActivity:preReleaseBuild UP-TO-DATErn:initActivity:compileReleaseNdk UP-TO-DATErn:initActivity:compileLintrn:initActivity:copyReleaseLint UP-TO-DATErn:initActivity:mergeReleaseProguardFiles UP-TO-DATErn:initActivity:packageReleaseRenderscript UP-TO-DATErn:initActivity:checkReleaseManifestrn:initActivity:prepareReleaseDependenciesrn:initActivity:compileReleaseRenderscript UP-TO-DATErn:initActivity:generateReleaseResValues UP-TO-DATErn:initActivity:generateReleaseResources UP-TO-DATErn:initActivity:packageReleaseResources UP-TO-DATErn:initActivity:compileReleaseAidl UP-TO-DATErn:initActivity:generateReleaseBuildConfig UP-TO-DATErn:initActivity:generateReleaseAssets UP-TO-DATErn:initActivity:mergeReleaseAssets UP-TO-DATErn:initActivity:processReleaseManifest UP-TO-DATErn:initActivity:processReleaseResources UP-TO-DATErn:initActivity:generateReleaseSources UP-TO-DATErn:initActivity:compileReleaseJavaWithJavac UP-TO-DATErn:initActivity:processReleaseJavaRes UP-TO-DATErn:initActivity:transformResourcesWithMergeJavaResForRelease UP-TO-DATErn:initActivity:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATErn:initActivity:mergeReleaseJniLibFolders UP-TO-DATErn:initActivity:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATErn:initActivity:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATErn:initActivity:bundleRelease UP-TO-DATErn:theDiamondExpress:preBuild UP-TO-DATErn:theDiamondExpress:preDebugBuild UP-TO-DATErn:theDiamondExpress:checkDebugManifestrn:theDiamondExpress:preDebugAndroidTestBuild UP-TO-DATErn:theDiamondExpress:preReleaseBuild UP-TO-DATErn:theDiamondExpress:prepareComAndroidSupportMultidex101Library UP-TO-DATErn:theDiamondExpress:prepareTheDiamondExpress1EaseUIUnspecifiedLibrary UP-TO-DATErn:theDiamondExpress:prepareTheDiamondExpress1InitActivityUnspecifiedLibrary UP-TO-DATErn:theDiamondExpress:prepareDebugDependenciesrn:theDiamondExpress:compileDebugAidl UP-TO-DATErn:theDiamondExpress:compileDebugRenderscript UP-TO-DATErn:theDiamondExpress:generateDebugBuildConfig UP-TO-DATErn:theDiamondExpress:generateDebugAssets UP-TO-DATErn:theDiamondExpress:mergeDebugAssets UP-TO-DATErn:theDiamondExpress:generateDebugResValues UP-TO-DATErn:theDiamondExpress:generateDebugResources UP-TO-DATErn:theDiamondExpress:mergeDebugResourcesrn:theDiamondExpress:processDebugManifestrn:theDiamondExpress:processDebugResources FAILEDrnError:Execution failed for task ':theDiamondExpress:processDebugResources'.rn> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\adt-bundle-windows-x86_64-20140321\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1rnInformation:BUILD FAILEDrnInformation:Total time: 1 mins 8.839 secsrnInformation:1 errorrnInformation:0 warningsrnInformation:See complete output in consolernrn这是我的bulid.gradle文件rnapply plugin: 'com.android.application'rnandroid rn compileSdkVersion 19rn buildToolsVersion '21.1.2'rn defaultConfig rn applicationId "com.XXX.xxxxxxx"rn minSdkVersion 9rn targetSdkVersion 21rn multiDexEnabled truernrn compileOptions rn sourceCompatibility JavaVersion.VERSION_1_7rn targetCompatibility JavaVersion.VERSION_1_7rn rn rn buildTypes rn release rn minifyEnabled falsern proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'rn rn rn packagingOptions rn exclude 'META-INF/NOTICE' // will not include NOTICE filern exclude 'META-INF/LICENSE' // will not include LICENSE filern exclude 'META-INF/DEPENDENCIES' // will not include LICENSE filern rn dependencies rn compile fileTree(dir: 'libs', include: ['*.jar'])rn compile 'com.google.code.gson:gson:2.2.4'rn compile files('libs/httpmime-4.3.6.jar')rn compile files('libs/SocialSDK_laiwang_2.jar')rn compile files('libs/SocialSDK_QQZone_1.jar')rn compile files('libs/SocialSDK_QQZone_2.jar')rn compile files('libs/SocialSDK_QQZone_3.jar')rn compile files('libs/SocialSDK_renren_1.jar')rn compile files('libs/SocialSDK_renren_2.jar')rn compile files('libs/SocialSDK_Sina.jar')rn compile files('libs/SocialSDK_sms.jar')rn compile files('libs/SocialSDK_tencentWB_1.jar')rn compile files('libs/SocialSDK_tencentWB_2.jar')rn compile files('libs/SocialSDK_tencentWB_3.jar')rn compile files('libs/SocialSDK_WeiXin_1.jar')rn compile files('libs/SocialSDK_WeiXin_2.jar')rn compile files('libs/SocialSDK_yixin_1.jar')rn compile files('libs/SocialSDK_yixin_2.jar')rn compile files('libs/umeng-analytics-v5.6.1.jar')rn compile files('libs/umeng-update-v2.6.0.1.jar')rn compile files('libs/umeng_social_sdk.jar')rn compile files('libs/universal-image-loader-1.9.4.jar')rn compile files('libs/zxing.jar')rn compile files('libs/activeandroid.jar')rn compile files('libs/alipaySDK-20150724.jar')rn compile files('libs/android-support-v7-recyclerview.jar')rn compile files('libs/Android_Location_V1.3.2.jar')rn compile files('libs/com.umeng.message_v2.8.0.jar')rn compile files('libs/fastjson-1.2.8.jar')rn compile files('libs/httpcore-4.3.2.jar')rn compile files('libs/jettison-1.0.1.jar')rn compile files('libs/jpush-sdk-release1.8.1.jar')rn compile files('libs/SocialSDK_email.jar')rn compile files('libs/SocialSDK_laiwang_1.jar')rn compile files('libs/umeng_community_location.jar')rn compile files('libs/umeng_community_push.jar')rn compile files('libs/umeng_community_sdk_core.jar')rn compile files('libs/umeng_community_sdk_db.jar')rn compile files('libs/umeng_community_sdk_login.jar')rn compile files('libs/umeng_community_sdk_ui_discuss.jar')rn rnrn dexOptions rn //jumboMode truern javaMaxHeapSize "3500m"rn rnrnrndependencies rn compile project(':initActivity')rn compile project(':easeUI')rnrnrn求解决方案,谢谢rn 论坛

android stuido 求大神指点 Gradle build finished

06-29

UNEXPECTED TOP-LEVEL EXCEPTION:ncom.android.dex.DexException: Multiple dex files define Lcom/lidroid/xutils/task/TaskHandler;n at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)n at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)n at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)n at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)n at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)n at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)n at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)n at com.android.dx.command.dexer.Main.run(Main.java:230)n at com.android.dx.command.dexer.Main.main(Main.java:199)n at com.android.dx.command.Main.main(Main.java:103)nnn FAILEDnnFAILURE: Build failed with an exception.nn* What went wrong:nExecution failed for task ':app:dexDebug'.n> com.android.ide.common.internal.LoggedErrorException: Failed to run command:n D:\Android\android-studio\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output E:\一点通\新闻客户端APP\code\android\XMRBApp\app\build\intermediates\dex\debug E:\一点通\新闻客户端APP\code\android\XMRBApp\app\build\intermediates\classes\debug E:\一点通\新闻客户端APP\code\android\XMRBApp\app\build\intermediates\dependency-cache\debug E:\一点通\新闻客户端APP\code\android\XMRBApp\app\build\intermediates\pre-dexed\debug\baseproject-c56c14be9943929c5c5813d4553338c6b5b2977e.jar E:\一点通\新闻客户端APP\code\android\XMRBApp\app\build\intermediates\pre-dexed\debug\classes-1f8f8478b937dc74b01aabab03122fad3284ca52.jar E:\一点通\新闻客户端APP\code\android\XMRBApp\app\build\intermediates\pre-dexed\debug\classes-1ff5837b36cb81358fc0327eb8469bcf0233db7d.jar nError Code:n 2nOutput:n n UNEXPECTED TOP-LEVEL EXCEPTION:n com.android.dex.DexException: Multiple dex files define Lcom/lidroid/xutils/task/TaskHandler;n at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)n at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)n at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)n at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)n at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)n at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)n at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)n at com.android.dx.command.dexer.Main.run(Main.java:230)n at com.android.dx.command.dexer.Main.main(Main.java:199)n at com.android.dx.command.Main.main(Main.java:103)n nnn* Try:nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.nnBUILD FAILEDn求大神指点!!!感谢感谢 问答

没有更多推荐了,返回首页