Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Java heap space OutOfMemoryError when binding a big .jar

$
0
0

Hi, I'm trying to bind BurstlySDK to my mono for Android project.

According to the steps described here http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)

I did the following:

created Android Java Bindings library project called "BurstlyBindingLibrary"

created Jars filter there and a corresponding folder, copied BurstlySDK.jar, added to project, set EmbeddedJar in properties.

added 2 other jars on which Burstly was dependant (admobfix.jar and joda-time-2.1.jar) and marked them as EmbeddedReferenceJar in properties.

tweaked the Metadata.xml to remove and rename some nodes in API.xml so that BurstlyBindingLibrary finally compiles.

to the main project added the same 3 jars and marked them as AndroidJavaLibrary in properties

right-clicked on the main project, Add reference, selected project BurstlyBindingLibrary ("BurstlyBindingLibary" now shows in References of the main project)

Now, when trying to build the main project, I get the following error:

COMPILETODALVIK : UNEXPECTED TOP-LEVEL error : 
  java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuilder.append(StringBuilder.java:119)
at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
at com.android.dx.rop.type.Prototype.intern(Prototype.java:180)
at com.android.dx.cf.iface.StdMethod.<init>(StdMethod.java:45)
at com.android.dx.cf.direct.MethodListParser.set(MethodListParser.java:80)
at com.android.dx.cf.direct.MemberListParser.parse(MemberListParser.java:217)
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:532)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:396)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:378)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:241)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:112)
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)

Googling only finds this: https://code.google.com/p/android/issues/detail?id=20814 which says the jar has >65k methods. Is this the case here, too(?)

BurstlySDK.jar is pretty big (2.8MB) and contains lots of stuff inside, probably indeed >65k methods.

I tried making a usual android project in Eclipse and added the BurstlySDK.jar there, it builds fine and runs on the device, though it seems to strip the jar (BurstlySDK....jar inside bin/dexedLibs/ is only 1MB instead of 2.8MB) since the test project in Eclipse does nothing except BurstlySDK.init(..).

If the huge amount of methods is the problem, then I guess the solution would be to remove more nodes from API.xml, maybe entire packages. Or is this something else.

Any suggestions? Thanks!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>