当我尝试编译(不执行)我的一个项目时,我最近收到以下错误:
Tool /usr/bin/java execution started with arguments: -jar /Applications/android-sdk-mac_x86/platform-tools/lib/dx.jar --no-strict --dex --output=obj/Debug/android/bin/classes.dex obj/Debug/android/bin/classes /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/mono.android.jar FlurryAnalytics/Jars/FlurryAgent.jar Jars/android-support-v4.jar
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at com.android.dx.rop.code.RegisterSpecSet.<init>(RegisterSpecSet.java:49)
at com.android.dx.rop.code.RegisterSpecSet.mutableCopy(RegisterSpecSet.java:383)
at com.android.dx.ssa.LocalVariableInfo.mutableCopyOfStarts(LocalVariableInfo.java:169)
at com.android.dx.ssa.LocalVariableExtractor.processBlock(LocalVariableExtractor.java:104)
at com.android.dx.ssa.LocalVariableExtractor.doit(LocalVariableExtractor.java:90)
at com.android.dx.ssa.LocalVariableExtractor.extract(LocalVariableExtractor.java:56)
at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:50)
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 com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
其他项目按预期构建。我想我需要增加这个java构建步骤的堆大小?但是如何?
答案 0 :(得分:20)
Xamarin Studio中有一个选项可以增加Java堆大小。
项目选项 - &gt; Android Build - &gt;高级 - &gt; Java堆大小。
答案 1 :(得分:5)
This suggestion做了诀窍:
$ export _JAVA_OPTIONS="-Xmx1g"
$ /Applications/MonoDevelop.app/Contents/MacOS/MonoDevelop
我的项目中有几个jar文件。 Flurry,Maps和Newtonsoft ......显然这足以轰炸构建。
感谢令人敬畏的Xamarin支持团队快速响应并指出解决方案!他们正致力于减少外部罐子所需的内存占用。