To do this set org.gradle.jvmargs=-Xmx3072M in the project gradle.properties.

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mo_feng_/article/details/79176291

1、To do this set org.gradle.jvmargs=-Xmx3072M in the project gradle.properties.
打包报这个错误,很郁闷,我mudel里的gradle写了

javaMaxHeapSize "2048M"

project里的gradle.properties写的是

org.gradle.jvmargs=-Xmx3072M

死活报错,后来把2048改成1024,把3072改成2048,没这个错误了,
2、但出现如下错误

:argracesmart:transformClassesWithDexForRelease
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.aliyun.alink.sdk.bone.plugins.c) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
。。。
。。。
Error:Execution failed for task ':argracesmart:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: 
method ID not in [0, 0xffff]: 65536

这个错误是指,工程中引入了多个第三方jar包,导致调用的方法数超过了android设定的65536个。
解决办法:http://www.cnblogs.com/yeahgis/p/4660873.html

defaultConfig { 
   ... 
multiDexEnabled true 
... 
}
dependencies { 
... 
   compile 'com.android.support:multidex:1.0.1' 
   ... 
}

可以参考下面的地址:
https://stackoverflow.com/questions/27377080/after-update-of-as-to-1-0-getting-method-id-not-in-0-0xffff-65536-error-i

3、上面两个问题解决了,出现第三个问题

Error:Execution failed for task ':argracesmart:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: 
duplicate entry: com/taobao/appmonitor/BuildConfig.class

这是阿里的问题:
https://iot.aliyun.com/docs/develop/faq/android.html
解决方法是: 删除libs文件夹下的app-monitor-sdk-2.6.0_for_bc.jar文件,并删除build.gradle文件中的依赖:

compile files('libs/app-monitor-sdk-2.6.0_for_bc.jar')

至此终于搞定,丫蛋的,太折腾人了。

猜你喜欢

转载自blog.csdn.net/mo_feng_/article/details/79176291