compile failed

Monkey Targets Forums/Android/compile failed

dave.h(Posted 2011) [#1]
i get this error when i try to add another level to my game


compile:
[javac] C:\Program Files\Android\android-sdk\tools\ant\main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to C:\Users\dave\Desktop\enferno2\enferno2.build\android\bin\classes
[javac] C:\Users\dave\Desktop\enferno2\enferno2.build\android\src\com\monkey\MonkeyGame.java:2730: code too largeERROR:
BUILD FAILED
C:\Program Files\Android\android-sdk\tools\ant\main_rules.xml:384: Compile failed; see the compiler error output for details.

Total time: 1 second
[javac] static public int bb_new_level(){
[javac] ^
ERROR:
[javac] Note: C:\Users\dave\Desktop\enferno2\enferno2.build\android\src\com\monkey\MonkeyGame.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
Android build failed.
Error in compilation!


so im looking at the line

C:\Users\dave\Desktop\enferno2\enferno2.build\android\src\com\monkey\MonkeyGame.java:2730: code too largeERROR:
BUILD FAILED

and getting worried.Is this simply what it says or is there a way round because if the code is to large thats worring because there really isnt that much code only 1711 lines.It will build in html but not android and ive tried it in release and debug mode.


dave.h(Posted 2011) [#2]
ok i figured it out.It seems a function cant be bigger than a certain size when compiling in android.


therevills(Posted 2011) [#3]
Yep you've found one of many Java limits ;)

64K method byte-code limit
64K number of constants in a class
64K number of local variables in a method
64K operand stack limit
64K limit on number of fields
64K limit on number of methods
255 limit on number of dimensions
4GB limit on virtual machine addressing on 32-bit machines
255 limit on number of method arguments (127 if double types)


How many lines of code was the offending function in Monkey?


dave.h(Posted 2011) [#4]
it fails somewhere after 598 lines of code.Not sure exactly as i removed the offending code and started another function.Wasnt to difficult as all the code in the function was level data anyway.


AdamRedwoods(Posted 2011) [#5]
I wonder if debug-mode increases the size of code significantly.


therevills(Posted 2011) [#6]
Actually I think it would, good thinking - due to all the "debug" logs which gets added to the generated code. Every line of code inside a method gets a debug statement added, so a 10 line method becomes a 20 line debug method.

It would be nice if Monkey warns you of this when "compiling".


AdamRedwoods(Posted 2011) [#7]
The problem I see with Android being rather large, is that monkey adds debugging info with strings and FULL PATH in every single string.

DOH!

This will need to be addressed.

example:
bb_std_lang.errInfo="H:/_work/software_dev/_monkey/bigbugs_td/bigbugs_main_v01.monkey<219>";
bb_std_lang.errInfo="H:/_work/software_dev/_monkey/bigbugs_td/bigbugs_main_v01.monkey<219>";


for almost every line of code.