build failed

Monkey Targets Forums/Android/build failed

amonite(Posted 2012) [#1]
Hello, when trying to compile my game i get this error :
-compile:
[javac] Compiling 3 source files to D:\Programming\MonkeyDepo\MySamples\NewGame\NewGame.build\android\bin\classes
[javac] D:\Programming\MonkeyDepo\MySamples\NewGame\NewGame.build\android\src\com\monkey\MonkeyGame.java:17653: code too large
[javac] public static int bbInit(){
[javac] ^
[javac] Note: D:\Programming\MonkeyDepo\MySamples\NewGame\NewGame.build\android\src\com\monkey\MonkeyGame.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error

BUILD FAILED
C:\Users\Amonite\AppData\Local\Android\android-sdk\tools\ant\build.xml:679: The following error occurred while executing this line:
C:\Users\Amonite\AppData\Local\Android\android-sdk\tools\ant\build.xml:692: Compile failed; see the compiler error output for details.

Total time: 3 seconds
TRANS FAILED: Android build failed.
Done.

Not sure what it means.


therevills(Posted 2012) [#2]
In Java you have a 64K limit on methods and depending on how you coded Monkey, Monkey will generate a method that breaks this limit.

Do you have any really large pieces of code that you could put in new methods?


amonite(Posted 2012) [#3]
Thank you for helping me, i have refactored the code, now all methods under 64k but same error as before :/

Are there any other limits in Java that you know of ?


Amon(Posted 2012) [#4]
Hey!

I had similar problems to yours a while ago. I do recall having the same error but also another.

It seemed to all fix itself though when I followed a thread on the subject and tried the solution. Here's a link to my post.

http://www.monkeycoder.co.nz/Community/post.php?topic=2816&post=28742


amonite(Posted 2012) [#5]
Thank you Amon but the fix you suggest doesn't work for me.


Amon(Posted 2012) [#6]
Ok! Have you tried deleting the builds folder in your main games folder and rebuilding?


Amon(Posted 2012) [#7]
Another thing to try! Are you using collections without type-specifiers?

Some people get this error when they do so as discussed here: http://stackoverflow.com/questions/197986/what-causes-javac-to-issue-the-uses-unchecked-or-unsafe-operations-warning


amonite(Posted 2012) [#8]
Thanks again but i did that and i have no unspecified types too.
There is still the code too large error.
I'm going to try to refactor the code more.


therevills(Posted 2012) [#9]
now all methods under 64k but same error as before :/

Your Monkey methods or the generated Java methods?

Other Java limits:

64K method bytecode 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 diminsions
4GB limit on virtual machine addressing on 32-bit machines
255 limit on number of method arguments (127 if double types)