如果项目比较大代码较多,在打包时,可能会出现
java.lang.OutOfMemoryError: Java heap space
解决方法:\sdk\tools\proguard\bin\proguard.bat
java -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
添加-Xmx1024m -Xms1024m参数,调高JVM 的使用内存;即变成
java -Xmx1024m -Xms1024m -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
[2014-11-11 14:05:50 - xxx] Proguard returned with error code 1. See console [2014-11-11 14:05:50 - xxx] Note: there were 3040 duplicate class definitions. [2014-11-11 14:05:50 - xxx] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [2014-11-11 14:05:50 - xxx] at java.util.Arrays.copyOfRange(Arrays.java:3209) [2014-11-11 14:05:50 - xxx] at java.lang.String.<init>(String.java:216) [2014-11-11 14:05:50 - xxx] at proguard.classfile.constant.Utf8Constant.getStringRepresentation(Utf8Constant.java:283) [2014-11-11 14:05:50 - xxx] at proguard.classfile.constant.Utf8Constant.switchToStringRepresentation(Utf8Constant.java:174) [2014-11-11 14:05:50 - xxx] at proguard.classfile.constant.Utf8Constant.getString(Utf8Constant.java:128) [2014-11-11 14:05:50 - xxx] at proguard.classfile.ProgramClass.getString(ProgramClass.java:116) [2014-11-11 14:05:50 - xxx] at proguard.classfile.constant.NameAndTypeConstant.getType(NameAndTypeConstant.java:104) [2014-11-11 14:05:50 - xxx] at proguard.classfile.ProgramClass.getType(ProgramClass.java:164) [2014-11-11 14:05:50 - xxx] at proguard.classfile.constant.RefConstant.getType(RefConstant.java:103) [2014-11-11 14:05:50 - xxx] at proguard.classfile.util.ClassReferenceInitializer.visitAnyRefConstant(ClassReferenceInitializer.java:195) [2014-11-11 14:05:50 - xxx] at proguard.classfile.util.SimplifiedVisitor.visitAnyMethodrefConstant(SimplifiedVisitor.java:192) [2014-11-11 14:05:50 - xxx] at proguard.classfile.util.SimplifiedVisitor.visitMethodrefConstant(SimplifiedVisitor.java:204) [2014-11-11 14:05:50 - xxx] at proguard.classfile.constant.MethodrefConstant.accept(MethodrefConstant.java:69) [2014-11-11 14:05:50 - xxx] at proguard.classfile.ProgramClass.constantPoolEntriesAccept(ProgramClass.java:445) [2014-11-11 14:05:50 - xxx] at proguard.classfile.util.ClassReferenceInitializer.visitProgramClass(ClassReferenceInitializer.java:97) [2014-11-11 14:05:50 - xxx] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) [2014-11-11 14:05:50 - xxx] at proguard.classfile.ClassPool.classesAccept(ClassPool.java:116) [2014-11-11 14:05:50 - xxx] at proguard.Initializer.execute(Initializer.java:98) [2014-11-11 14:05:50 - xxx] at proguard.ProGuard.initialize(ProGuard.java:211) [2014-11-11 14:05:50 - xxx] at proguard.ProGuard.execute(ProGuard.java:86) [2014-11-11 14:05:50 - xxx] at proguard.ProGuard.main(ProGuard.java:492)
时间: 2024-10-11 22:46:29