Android Question issue solved

ilan

Expert
Licensed User
Longtime User
B4A Version: 8.80
Parsing code. (0.40s)
Building folders structure. (0.01s)
Compiling code. (0.43s)
Compiling layouts code. (0.04s)
Organizing libraries. (1.39s)
Generating R file. (0.32s)
Compiling generated Java code. (2.43s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.android.dx.util.ByteArray.slice(ByteArray.java:98)
at com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:417)
at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:271)
at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:153)
at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:127)
at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:118)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:505)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:420)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:402)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:253)
at com.android.dx.command.dexer.Main.parseClass(Main.java:851)
at com.android.dx.command.dexer.Main.access$7(Main.java:846)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1822)
at com.android.dx.command.dexer.Main.processClass(Main.java:834)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:802)
at com.android.dx.command.dexer.Main.access$3(Main.java:773)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1775)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:756)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:650)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.runDx(Main.java:293)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
 

Peter Simpson

Expert
Licensed User
Longtime User
Darnit,
I thought that #VirtualMachineArgs was also in B4A as #VirtualMachineArgs is in B4J.

Sorry about that @ilan, I'm just replying on my phone, grrr...

Maybe that would make a nice feature request in the wish list, but there's probably another way around it.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
You can try to change limit for Dex
MaxRamForDex=4092
in file
c:\Users\<YOUR_USER>\AppData\Roaming\Anywhere Software\Basic4android\b4xV5.ini
You also need to have x64 Java SDK, as Dex cannot use this amount of ram with x86 java SDK.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You can try to add this line to your main module
B4X:
#MultiDex: true
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Hiya @ilan
Hmm, I've just got back in and thought to myself that you can probably use Windows environment variables to fix your problem.

My variables already have the following setup '-Xmx1024m -Xms1024m', You can just add more options like '-XX:-UseGCOverheadLimit'.

Untitled-2.png


I've just decided to add '-XX:-UseGCOverheadLimit' to the end of my _JAVA_OPTIONS variables, so now mine reads as follows
'-Xmx1024m -Xms1024m -XX:-UseGCOverheadLimit', give it a go it will not hurt.

When ran in B4J the logs will say that it has pick up Java options, nothing appears in B4A logs when ran but java options are still executed.

That's my way of fixing memory issues and using java options, yes there are other ways to do it but this works for me.

I believe that using #VirtualMachineArgs in B4J is basically the same as setting it up as in the screenshot above. it would be nice to have #VirtualMachineArgs in B4A, but it does not have it so I use Windows environment variables.

This is where Erel responds by saying there is an easier way ;), but this way it's set all the time when Windows is loaded.
 
Last edited:
Upvote 0

ilan

Expert
Licensed User
Longtime User
thanx for all answers here. i have tried to increase the dexmemory value in the ini file but it doesnot help and also i noticed that it is set back to 1024 after compile. i am not sure what is setting that value back.

the error message also get more and more weird:

B4A Version: 8.80
Parsing code. (0.43s)
Building folders structure. (0.01s)
Compiling code. (0.32s)
Compiling layouts code. (0.04s)
Organizing libraries. (1.56s)
Generating R file. (0.33s)
Compiling generated Java code. (2.39s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.android.dx.cf.code.LineNumberList.set(LineNumberList.java:100)
at com.android.dx.cf.direct.StdAttributeFactory.lineNumberTable(StdAttributeFactory.java:524)
at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory.java:186)
at com.android.dx.cf.direct.AttributeFactory.parse(AttributeFactory.java:96)
at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.java:142)
at com.android.dx.cf.direct.AttributeListParser.parseIfNecessary(AttributeListParser.java:115)
at com.android.dx.cf.direct.AttributeListParser.getList(AttributeListParser.java:106)
at com.android.dx.cf.direct.StdAttributeFactory.code(StdAttributeFactory.java:336)
at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory.java:150)
at com.android.dx.cf.direct.AttributeFactory.parse(AttributeFactory.java:96)
at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.java:142)
at com.android.dx.cf.direct.AttributeListParser.parseIfNecessary(AttributeListParser.java:115)
at com.android.dx.cf.direct.AttributeListParser.getEndOffset(AttributeListParser.java:96)
at com.android.dx.cf.direct.MemberListParser.parse(MemberListParser.java:213)
at com.android.dx.cf.direct.MemberListParser.parseIfNecessary(MemberListParser.java:108)
at com.android.dx.cf.direct.MethodListParser.getList(MethodListParser.java:54)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:565)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:420)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:402)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:253)
at com.android.dx.command.dexer.Main.parseClass(Main.java:851)
at com.android.dx.command.dexer.Main.access$7(Main.java:846)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1822)
at com.android.dx.command.dexer.Main.processClass(Main.java:834)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:802)
at com.android.dx.command.dexer.Main.access$3(Main.java:773)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1775)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:756)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:638)

i have tried to use b4a8.5 again but now it also doesnot compile there. the weird thing is that i compiled 5 days ago successfully so why is it not working now???
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
why is it not working now???
because you now use another SDK Installation.

Seems that it is related to the libraries you are using inside your project maybe.

To your issue: Try to reproduce the problem in a small new project and upload this project.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
because you now use another SDK Installation.

Seems that it is related to the libraries you are using inside your project maybe.

To your issue: Try to reproduce the problem in a small new project and upload this project.

if i run other project they work. what i also tried is running this specific project on my other laptop and there it does compile. the thing is that the ini in that pc has 4096 set to maxdex and when i set the same value to my new laptop it is not stored. after compile the ini is always set back to 1024.

do i need to set it to read only after changing it?
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Make sure to edit the ini file while NO IDE is running at this time.

yeah maybe thatsthe problem. i just figured out that the ini cannot be readonly because the ide saves stuff to it so changed back to make it writeable and the 4096 is still there and the app build is successfully. so the problem was maybe that i changed it while ide was running and it always set it back to 1024.

thanx to all of you guys :)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
This error has nothing to do with v8.80. It is unfortunate that you set the title to "since b4a 8.80 only troubles :(" as you are causing developers to avoid using the latest version for no good reason.

ok, you can delete this thread.
 
Upvote 0
Top