Android studio 打包的时候报错(锦集)

今天打包的时候突然报了这么多错误,然后写一下主要会导致的错误:

下面是错误日志:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list D:\pbs_v0.01\pbs_v3.1\app\build\intermediates\multi-dex\debug\maindexlist.txt --output D:\pbs_v0.01\pbs_v3.1\app\build\intermediates\transforms\dex\debug\folders\1000\1f\main D:\pbs_v0.01\pbs_v3.1\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}

1.:其文件的方法引用超过了65535个方法限制, 
解决方法:在应用级gradle上面添加

multiDexEnabled true
以及
dexOptions {
    javaMaxHeapSize "4g"
}

2.PNG照片不符,直接在proguard-rules.pro文件把限制去掉,显示为不提示报警;

#优化显示配置
-keepattributes InnerClasses-dontoptimize
-optimizations optimization_filter

3.还有一种是第三方包重复调用,只要替换一下应该就可以了,这里我没遇到,就不详细说了。

猜你喜欢

转载自blog.csdn.net/weixin_42270094/article/details/84565443