Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
264 views
in Technique[技术] by (71.8m points)

android - How to fix "OutOfMemoryError: java heap space" while compiling MonoDroid App in MonoDevelop

When I try to compile (not execute) one of my projects, I recently get the following error:

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)

Other projects build as expected. I think I need to increase the heap size for this java build step? But how?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is an option in Xamarin Studio to increase the Java Heap Size.

Project Options -> Android Build -> Advanced -> Java Heap Size.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...