Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Build Error: Method code too large

Tags:

codenameone

When sending Andoird Build to server I get the following build error:

Error! Failed to transform some classes java.lang.RuntimeException: Method code too large! at net.orfjackal.retrolambda.asm.MethodWriter.getSize(MethodWriter.java:2036) at net.orfjackal.retrolambda.asm.ClassWriter.toByteArray(ClassWriter.java:827) at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:121) at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:106) at net.orfjackal.retrolambda.Transformers.backportClass(Transformers.java:46) at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:72) at net.orfjackal.retrolambda.Main.main(Main.java:26)

I must confess I'm not sure why this is occurring as I do not references these classes. Could someone please explain how to track down the cause and fix it? I have not added any new imports since the last successful build :/ My project is also set to use Java 8. Not sure where to go from here to be honest.

like image 494
RoboLam Avatar asked May 18 '26 20:05

RoboLam


1 Answers

there is a hard limit on the size of methods in a class file of 64k. You have at least one big method that you need to split up. It may have been coming in just under the limit for the initial compilation but the retrolambda conversion just pushed it over. You need to split these methods into smaller methods.

This error doesnt really give you a clue as to which methods are problematic but you can probably eyeball it.

like image 132
steve hannah Avatar answered May 20 '26 10:05

steve hannah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!