Android Question "error: too many constants"

kepler

Active Member
Licensed User
Good evening,

After a hard work, and saving a prototype project in B4A without any problems, when I try to compile it I get the message:

javac 1.7.0_60
src\programs\almagest\module2.java:7: error: too many constants
public class planets {
^
1 error


Is there any limit in a static module that I'm not aware?

Kind regards,

Kepler
 

kepler

Active Member
Licensed User
Good morning Erel :)

I've figured it out.
I was trying to compile a module with 1.99 MB!!!
Not a good idea...
So I've made separated modules, and the problem was gone.
Also, I had a memory problem - solved changing the value in the B4A ini file: MaxRamForDex=1536
And... had some freezing problems also, because I declared an array as Dim nArray(0 to 2) instead of Dim nArray(3) - only troubles...

Kind regards,

Kepler
 

Rick Harris

Well-Known Member
Licensed User
Good morning Erel :)

I've figured it out.
I was trying to compile a module with 1.99 MB!!!
Not a good idea...
So I've made separated modules, and the problem was gone.
Also, I had a memory problem - solved changing the value in the B4A ini file: MaxRamForDex=1536
And... had some freezing problems also, because I declared an array as Dim nArray(0 to 2) instead of Dim nArray(3) - only troubles...

Kind regards,

Kepler
Where is this "B4A ini file"? It is not in the B4A Program Files directory.
 

Rick Harris

Well-Known Member
Licensed User
In Debug (Legacy) mode I also still get a "Too Many Constants" error.
I have understood that the maximum number of constants is 65365.
Can someone please explain how to count the constants?
Better still: can B4A do a constants count?
Why does this problem not occur in Release mode? I.e. how many constants does the Debugger add to the total count?
 
Top