javagwtintellij-13

Pre Dexing gwt-user.jar causes a OutOfMemoryError from the Garbage Collector


I've been trying to get gwt set up with an Android project and after adding the sdk to my build path, the compilation hangs on this problem.

I am using IntelliJ Ultimate 13.1 and the android app is the skeleton that comes with it.

here is the full traceback:

Error:Android Pre Dex: [gwt-user.jar] Unable to execute DX
Error:Android Pre Dex: [gwt-user.jar] java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.util.Bits.makeBitSet(Bits.java:38)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.util.BitIntSet.<init>(BitIntSet.java:35)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.ssa.SetFactory.makeDomFrontSet(SetFactory.java:66)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.ssa.DomFront.run(DomFront.java:103)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.ssa.SsaConverter.placePhiFunctions(SsaConverter.java:297)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:51)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.processClass(Main.java:682)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.access$600(Main.java:78)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.processOne(Main.java:596)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
Error:Android Pre Dex: [gwt-user.jar] at com.android.dx.command.dexer.Main.run(Main.java:230)
Error:Android Pre Dex: [gwt-user.jar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:Android Pre Dex: [gwt-user.jar] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error:Android Pre Dex: [gwt-user.jar] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error:Android Pre Dex: [gwt-user.jar] at java.lang.reflect.Method.invoke(Method.java:606)
Error:Android Pre Dex: [gwt-user.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161)
Error:Android Pre Dex: [gwt-user.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294)

Solution

  • Disclosure: I've never done any serious Android dev, and I don't actually know what "pre dex" really means.

    There's absolutely no reason to package gwt-user into an Android app.

    Either you package JS that's been produced by GWT, and you only need GWT at compile-time; or you want to use RequestFactory and you should use requestfactory-client.jar instead. There might be other situations where you want to use other GWT classes that are not in requestfactory-client (e.g. RegExp or SafeHtml), in which case you'd have to either extract them into your own JAR, or maybe just use gwt-servlet.