Android Question Timeout on "Convert byte code - optimized dex"

sirjo66

Well-Known Member
Licensed User
Longtime User
Hello to all,
with B4A 8.30 I create a new app, I don't add any line of code, and I compile it.
Time for to execute line "Convert byte code - optimized dex" is 8.00 sec.

Now I want to add "Firebase messaging", so go to page
https://www.b4x.com/android/forum/t...s-firebase-cloud-messaging-fcm.67716/#content
I follow the guide and, INCREDIBLE, it works !!

But now, when I compile the app, the line "Convert byte code - optimized dex" throws timeout
Well, I change MaxRamForDex = 2048, and I change IDE Timeout = 60 sec
I compile again and now it works, but the line needs 56 sec :( (too much time)

I think that I need to use #ExcludeClasses (like explaned in https://www.b4x.com/android/forum/threads/new-feature-three-birds-with-one-stone.63127/#content), but I don't know the exact command.

As explained I need to use ONLY FirebaseNotification

Thanks for the help
Sergio
 

DonManfred

Expert
Licensed User
Longtime User
I think that I need to use #ExcludeClasses
no. It is not needed anymore when you are using B4A 8.3
Try increase the timeout.
Do you have enough ram to give 2048 only for java? Must be free when running.
 
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
I'm using Win10 with 4GB (a laptop) but I can't increase it.
I don't know if it have enough ram to give 2048 for java
How can I test it ?
Now I restore MaxRamForDex = 1024 but the time don't change :(
 
Upvote 0

AscySoft

Active Member
Licensed User
Longtime User
Strange thing happend to me too from yesterday (on every project I try).
MaxRamForDex=2024
ProcessesTimeoutSeconds=60
and it don't pass (times out) convert byte code - optimized dex.
Then I changed the following
MaxRamForDex=4048
ProcessesTimeoutSeconds=120
I've got 16G of RAM (12 FREE when compiling) i7-6700HQ, WIN10 pro 64, all sdk updates, java 8sdk, B4A 8.3
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at java.io.DataInputStream.<init>(DataInputStream.java:396)
at com.android.dx.util.ByteArray$MyDataInputStream.<init>(ByteArray.java:356)
at com.android.dx.util.ByteArray.makeDataInputStream(ByteArray.java:260)
at com.android.dx.cf.direct.AnnotationParser.<init>(AnnotationParser.java:90)
at com.android.dx.cf.direct.StdAttributeFactory.runtimeInvisibleAnnotations(StdAttributeFactory.java:649)
at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory.java:159)
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: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)
Picked up _JAVA_OPTIONS: -Xmx512M
Then I deleted "_JAVA_OPTIONS: -Xmx512M" from system environment variables and compile again, same error
What is to be done?
 
Upvote 0

AscySoft

Active Member
Licensed User
Longtime User
I put "_JAVA_OPTIONS: -Xmx512M" back on, changed ProcessesTimeoutSeconds=300 and compile in Release mode (slower)
B4A Version: 8.30
Parsing code. (0.25s)
Running custom action. (0.05s)
Compiling code. (0.78s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.03s)
Organizing libraries. (0.00s)
Generating R file. (0.74s)
Compiling generated Java code. (2.63s)
Convert byte code - optimized dex. Error
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.Channel$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.ChannelSftp$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.ConfigRepository$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.ConfigRepository$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.JSch$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.ChannelSftp$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.ChannelSftp$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.jcraft.jsch.Util$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
Picked up _JAVA_OPTIONS: -Xmx512M
 
Upvote 0

AscySoft

Active Member
Licensed User
Longtime User
UPDATE: I install java sdk 10 64 bit
I system environment variables i change java options -xmx8g (as adviced in other forum)
In b4aV5.ini file i change the folowing
MaxRamForDex=8192
ProcessesTimeoutSeconds=300
I then compilled with Release obfuscate and after 1 min and 20 secs i've got the folowing result
B4A Version: 8.30
Parsing code. (0.24s)
Running custom action. (0.05s)
Compiling code. (0.45s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.02s)
Organizing libraries. (0.00s)
Generating R file. (0.73s)
Compiling generated Java code. (4.34s)
Convert byte code - optimized dex. Error
Picked up _JAVA_OPTIONS: -Xmx512M
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
I think this error is ridiculous, how much memory will java need to build up a 3 MB app?
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Hello @AscySoft and @sirjo66, did you sort your issues out?
If not you could always try doing the following.

  1. Increase _JAVA_OPTIONS from -Xmx512m -Xms512m to -Xmx1024m -Xms1024m
  2. My MRFD has been set too MaxRamForDex=4096 for years now
Now reboot your computer and try assembling your code to a real device again. Oddly enough I have to do to the above with the Dropbox V2 library in one of my apps. Don't ask me why, but if I don't then I just have continuous dexing issues until I do points 1 above then restart my development laptop which is 7th generation i7 with newest Samsung SSD and 16GB of ram before somebody says it's my hardware.
 
Last edited:
Upvote 0

AscySoft

Active Member
Licensed User
Longtime User
Hi there @Peter Simpson and everyone else who will read this post.
Indeed my trouble seems to wanish away after my system was put to sleep mode and then restored frome there!! Don't know why??!!

My build configs are right now (if somebody find this useful - see my specs above)
1. _JAVA_OPTIONS -Xmx8G
2. MaxRamForDex=8192

Yesterday I literally fall asleep (and my PC also) then the next thing that I do when I woke up was to compil again the project. This time the compilation succeded without any errors as mentioned above!!??

Man, is so good to fall asleep and that the problems to solved by themselves! :D:D:D
I had to think about it sooner! :)
 
Upvote 0
Top