Android Question [SOLVED] - Try/Catch compiler error after when a working app is compiled on a new computer with current B4A

rleiman

Well-Known Member
Licensed User
Longtime User
Greetings,

After setting up B4A on a new computer, I made a small test app which I compiled tested. It compile and ran ok. I tried to compile one of my working apps from Google Play and got this try/catch error. The sub routine in the error doesn't have any Try/Catch statements in it. What is it and how can I fix it so it will compile?

Is my installation not set correctly?

Thanks.
Screenshot 2021-03-11 at 20.45.49.png
 

Attachments

  • Screenshot 2021-03-11 at 21.42.07.png
    Screenshot 2021-03-11 at 21.42.07.png
    375.9 KB · Views: 170
Last edited:

rleiman

Well-Known Member
Licensed User
Longtime User
This error happens when the sub is too large and the Java compiler hits a limit. Split the sub into multiple subs.
Thanks for the reply. I will split it in half and see if it compiles.

Is this a new limit set by the current version of B4A or can I set the limit to a larger number? I ask because this is an app that's already on Google Play and I was able to compile it without the error in the previous version of B4A.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
I don't think so. BTW: Never try to catch huge code blocks (doesn't make sense as you assume that e.g. 500 lines of code are not working correctly). Use it only when it is really needed. If your app crashes, just check the problem (even if it's in production).
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
I can't believe I didn't notice it, but when you install a new copy of B4A they put it in Debug mode. When I changed it back to Release mode, it compiled like before without any errors or warnings.

Because of my stupidity for not paying attention, :rolleyes: I'm marking this thread as solved for any newbies installing B4A for the first time.

Anyway, I'm glad I still got useful tips from everyone. ;)
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
but when you install a new copy of B4A they put it in Debug mode
This happens because Debug mode adds extra code to your Subs. However it would seem that you have too much code in that Sub. Good programming practice is to have many smaller Subs rather than one big one! It makes understanding and debugging the code easier.
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
This happens because Debug mode adds extra code to your Subs. However it would seem that you have too much code in that Sub. Good programming practice is to have many smaller Subs rather than one big one! It makes understanding and debugging the code easier.
Thanks for the useful tip. :)
 
Upvote 0
Top