我正在在 Windows 7 64 位(8GB 内存)上运行的 Eclipse Juno 上开发一个 android 应用程序所以我有我的 android 项目,我将一些 jar 文件放在 /lib 文件夹中,以便我可以在我的应用程序中使用它们。这很好,直到我添加了作为 apache xml 解析器依赖项所需的 xalan.jar 文件。
当我尝试从 Eclipse 运行/部署我的应用程序以便它可以在我的手机上运行时,我开始在控制台中看到编译器警告,抱怨来自 xalan.jar 的类,然后 Eclipse 因内存不足堆空间异常而崩溃。
!ENTRY com.android.ide.eclipse.adt 4 0 2013-01-20 21:04:37.427
!MESSAGE Unable to execute dex: Java heap space
!STACK 0
java.lang.OutOfMemoryError: Java heap space
at com.android.dx.ssa.SsaBasicBlock.getRopLabelSuccessorList(SsaBasicBlock.java:393)
at com.android.dx.ssa.back.SsaToRop.convertBasicBlock(SsaToRop.java:299)
at com.android.dx.ssa.back.SsaToRop.convertBasicBlocks(SsaToRop.java:260)
at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:124)
at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:70)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:102)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
at com.android.dx.command.dexer.Main.processClass(Main.java:487)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:598)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
我尝试在网上搜索,但我发现最接近的是 stackoverflow 问题Eclipse crashing, getting heap exceptions - Out of Memory when trying to deploy an Android applicaiton which instructs to increase the heap-space memory。我从 256m 到 1024 做的,我仍然得到错误。
我删除了 xalan.jar,一切正常部署。有什么解决办法吗?
- - - - - - 编辑 - - - - - - -
将最大内存更新为 2048 后
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.android.dx.util.IntList.<init>(IntList.java:87)
at com.android.dx.rop.code.RopMethod.calcPredecessors(RopMethod.java:174)
at com.android.dx.rop.code.RopMethod.labelToPredecessors(RopMethod.java:95)
at com.android.dx.ssa.SsaBasicBlock.newFromRop(SsaBasicBlock.java:158)
at com.android.dx.ssa.SsaMethod.convertRopToSsaBlocks(SsaMethod.java:174)
at com.android.dx.ssa.SsaMethod.newFromRopMethod(SsaMethod.java:104)
at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:45)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
at com.android.dx.command.dexer.Main.processClass(Main.java:487)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:598)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)