Facing a Build Failed issue!

Hello Everyone , actually i am facing very strange issue when i did ant , an this the following issue
[java] WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(…) returned error code 5.
[java] Compiling module com.google.appinventor.YaClient
[java] Ignored 2 units with compilation errors in first pass.
[java] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[java] Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
[java] at java.awt.image.DataBufferInt.(DataBufferInt.java:75)
[java] at java.awt.image.Raster.createPackedRaster(Raster.java:467)
[java] at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
[java] at java.awt.image.BufferedImage.(BufferedImage.java:333)
[java] at sun.java2d.loops.GraphicsPrimitive.convertFrom(GraphicsPrimitive.java:557)
[java] at sun.java2d.loops.GraphicsPrimitive.convertFrom(GraphicsPrimitive.java:541)
[java] at sun.java2d.loops.MaskBlit$General.MaskBlit(MaskBlit.java:189)
[java] at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Blit.java:204)
[java] at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:959)
[java] at sun.java2d.pipe.DrawImage.renderImageCopy(DrawImage.java:577)
[java] at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:67)
[java] at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1014)
[java] at sun.java2d.pipe.ValidatePipe.copyImage(ValidatePipe.java:186)
[java] at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3318)
[java] at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3445)
[java] at com.google.gwt.resources.rg.ImageBundleBuilder.toPng(ImageBundleBuilder.java:546)
[java] at com.google.gwt.resources.rg.ImageResourceGenerator.reencodeToTempFile(ImageResourceGenerator.java:674)
[java] at com.google.gwt.resources.rg.ImageResourceGenerator.prepare(ImageResourceGenerator.java:587)
[java] at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:1015)
[java] at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:1041)
[java] at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.generateIncrementally(AbstractClientBundleGenerator.java:421)
[java] at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:739)
[java] at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:103)
[java] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
[java] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:262)
[java] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:251)
[java] at com.google.gwt.dev.PrecompilationContextCreator$1.getAllPossibleRebindAnswers(PrecompilationContextCreator.java:86)
[java] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:519)
[java] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:487)
[java] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.maybeHandleMagicMethodCall(UnifyAst.java:415)
[java] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.visit(UnifyAst.java:402)
[java] at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:265)

and terminal get stop at last line and it does not move forward .
I don’t why such a error is taking place , so how i can solve this ???
Regards,
Kunal

I think this from your RAM,need more space,
try rebuild again…

You will need to edit appengine/build.xml and increase the maximum amount of heap available to the GWT compiler in the YaClientApp target. Look for -Xmx and increase the value after it.

Thanks for your reply , can you also tell how much I should increase -Xmx1G to not face this issue again in future .
Regards,
Kunal

Sir @Official_KunalMishra
Im not sure this will work :thinking::joy:
try this :
On appinventor-sources/appinventor/buildserver/src/com/google/appinventor/buildserver/DexExecTask.java at master · mit-cml/appinventor-sources · GitHub in line 183
change

commandLineList.add("-mx" + mx + "M");

be

commandLineList.add("-mx" + 2 + "G");

or

commandLineList.add("-mx" + 3 + "G");

maybe work.

Doubling it to 2G from 1G should probably work. It’s impossible to know without knowing what changes were made.

Done but then also Error is same even I have also tried 3G , but the same error .
How to solve this problem ??

Well it’s impossible to know without knowing what you’ve changed, but one thing you could try is to remove the <collapse-all-properties/> line in YaClient.gwt.xml. This will just end up building many (smaller) variants but will alleviate some of the memory pressure.

1 Like

Actually I have made changes in UI of app Inventor like adding images in Dialogs and basically I have added Images and more .

@ewpatton can you also please tell that why such a error occurs , means major probability of coming this error is from which file or code ??
Why such error comes origin of error ?

The stack trace indicates that the JVM is running out of memory allocating an image. How large/many are the images you’ve added? If they’re particularly big (and they’re all being loaded into memory, which is why number is important), then that’s likely triggering the result. Typically we increase the max memory by ~512 MB or so every time, but we’ve only run into this issue once or twice over the lifetime of the development of App Inventor. Did you try my earlier suggestion of removing the <collapse-all-properties/> option?

Yes but the error is same , and

The images are 1 - 3MB in size .
If it is large then I have to make it small in size

@ewpatton I tried all solutions given by you but in result it doesn’t work for me .
Can u please help me more to fix this issues ??
Regards,
Kunal

You should first verify that you can build MIT’s master branch without issue.

1 Like

A post was split to a new topic: How to resolve the warning “Play Protect” while installing an app?

answer by @Official_KunalMishra

Thanks for your response and now problem is sort resolved , actually the error was image dimensions were too larger that’s why i was facing the issues.

other off topic part from the post moved to new post...
for new questions please start a new thread. thank you.
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.