关于finished with non-zero exit value 1、2、3的bug解决总结

在最近的一个项目中碰到好几次finished with non-zero exit value 1、finished with non-zero exit value 2、finished with non-zero exit value 3这种莫名其妙的bug导致程序编译不过去。现在闲下来了总结一下解决办法:

finished with non-zero exit value 2:出现这种bug一般是因为你的项目里面出现了重复的jar包导致的,这种场景一般是在你引用的第三方依赖包里面和你的项目中导入了相同的jar包,一般常见的有v4,v7包。出现这种情况仔细检查一下,解决方法就是删除掉你项目中多余的jar包,保留依赖包里面的jar包就可以了。如果实在是没有发现有重复的jar包的话建议你重新换一个v4或者v7包。比如:

compile 'com.android.support:appcompat-v7:23.0.1'
换成:
compile 'com.android.support:appcompat-v7:22.2.0'

finished with non-zero exit value 1:随着我的项目越来越大,到了最后面编译的时候又出现了这么一个玩意,后来百度了一下才发现也有很多和我一样遇到这种问题的,最终解决了这个问题的方法就是在build.gradle里面加入:

dexOptions {
        javaMaxHeapSize "4g"
    }

除了这种情况外也有可能子工程里面有资源图片是从主工程传入的提示图片重复,这个一般会提示哪张图片重复了,按照提示删除重复图片rebuild就可以了。如果以上两种方式都无法解决你的问题,或者你是把eclipse工程转移到android studio下的话那么检查一下你的launch icon的引用方式,如果是drawable的话给成mipmap,如果tools标红,manifest标签中增加xmlns:tools=”http://schemas.android.com/tools”即可。这里又要简单说一下在studio中drawable和mipmap的区别(mipmap下面放我们应用的icon,drawable下放我们应用的图片资源),具体的不多说,想详细了解的可以专门去百度一下。如果还无法解决的话欢迎留言一起讨论。

 finished with non-zero exit value 3:java堆内存不足,我在stack over上面有一种解决方法是把"compile fileTree(dir: 'libs', include: ['*.jar'])"
改成 "provided fileTree(dir: 'libs', include: ['*.jar'])",这样能解决问题,但是我修改了build里面的配置解决的,修改如下:

</pre><pre name="code" class="java" style="font-size: 14px;">dexOptions {
        javaMaxHeapSize "4g"
    }

,有碰到这种情况的都可以试试,bug嘛,就是多试试,哪种可以用哪种.



Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Launching lib\main.dart on AOSP on IA Emulator in debug mode... Support for Android x86 targets will be removed in the next stable release after 3.27. See https://github.com/flutter/flutter/issues/157543 for details. Running Gradle task 'assembleDebug'... ????: ?????????????????? worker.org.gradle.process.internal.worker.GradleWorkerMain ???: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain Could not write standard input to Gradle Worker Daemon 3. java.io.IOException: �ܵ����ڱ��رա� at java.base/java.io.FileOutputStream.writeBytes(Native Method) at java.base/java.io.FileOutputStream.write(Unknown Source) at java.base/java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.base/java.io.BufferedOutputStream.implFlush(Unknown Source) at java.base/java.io.BufferedOutputStream.flush(Unknown Source) at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68) at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61) at java.base/java.lang.Thread.run(Unknown Source) FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':gradle:compileGroovy'. > Failed to run Gradle Worker Daemon > Process 'Gradle Worker Daemon 3' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug
03-18
这是什么问题 Error:Execution failed for task ':app:processDebugResources'. > Failed to execute aapt Error:com.android.ide.common.process.ProcessException: Error while executing process E:\AndroidSDK\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I E:\AndroidSDK\platforms\android-26\android.jar -M \\?\E:\chapter02\Register\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S E:\chapter02\Register\app\build\intermediates\res\merged\debug -m -J \\?\E:\chapter02\Register\app\build\generated\source\r\debug -F E:\chapter02\Register\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.dell.register02 -0 apk --output-text-symbols \\?\E:\chapter02\Register\app\build\intermediates\symbols\debug --no-version-vectors} Error:org.gradle.process.internal.ExecException: Process 'command 'E:\AndroidSDK\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1 Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process E:\AndroidSDK\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I E:\AndroidSDK\platforms\android-26\android.jar -M \\?\E:\chapter02\Register\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S E:\chapter02\Register\app\build\intermediates\res\merged\debug -m -J \\?\E:\chapter02\Register\app\build\generated\source\r\debug -F E:\chapter02\Register\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.dell.register02 -0 apk --output-text-symbols \\?\E:\chapter02\Register\app\build\intermediates\symbols\debug --no-version-vectors} Error:(165, 31) No resource found that matches the given name (at 'layout_above' with value '@id/btn_submit'). Error:(165, 31) No resource found that matches the given name (at 'layout_above' with value '@id/btn_submit'). E:\chapter02\Register\app\build\intermediates\res\merged\debug\layout\activity_main.xml E:\chapter02\Register\app\src\main\res\layou
03-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值