Android Question error: code too large

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
hi,
I have a caompilation error:


Compilazione del codice Java prodotto. Error
javac 1.8.0_191
src\com\mamavi\slimup\ciclorisultante.java:13926: error: code too large
public void resume(BA ba, Object[] result) throws Exception{
^
1 error

I don't know what means
I saw in the forum same error for try catch but I haven't this code in this module

someone can help me?
thanks in advance
Marcom
 

DonManfred

Expert
Licensed User
Longtime User
what is the code in ciclorisultante?
 
Upvote 0

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
CicloRisultante is a module of over 13000 intructions.

I added 5 loop like this:

B4X:
            For i=1 To 34
                If Main.cardtrat5(i)<>Cols(i+2) Then
                    trattamenticomecard=False
                End If
            Next

whithout these lines app works.
These lines are in a sub with 100 instructions.

I temporarily solved by breaking the sub into two subs, but I don't know if it is the right solution
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
The rather unhelpful "code too large" error means that the Java bytecode emitted by the compiler has hit some size limit. It might be too many lines in a method, it might be the size of a class if this is a class module. I am a bit surprised that a recent Java compiler cannot cope with this, are you using a 32-bit JDK?
 
Upvote 0

emexes

Expert
Licensed User
The rather unhelpful "code too large" error means that the Java bytecode emitted by the compiler has hit some size limit. It might be too many lines in a method, it might be the size of a class if this is a class module.
There is a 64kB limit on method code size. Can't find the original reference right now, but it was a problem in this thread as well:

https://www.b4x.com/android/forum/t...s-from-spreadsheet-to-b4j.107941/#post-674937

But I can't imagine 100 lines getting anywhere near that limit.
These lines are in a sub with 100 instructions.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Not to mention trailing zeroes :)

Interestingly, we're talking about 1's and 0's ... eheheh
 
Upvote 0
Top