Android Question error: code too large

iCAB

Well-Known Member
Licensed User
Longtime User
Hi There,

I am trying to use the BarCode generation code in: https://www.b4x.com/android/forum/threads/qr-code-library.41408/#post-322509
When I try to compile the project, I am getting:

B4X:
src\JHSBarcodes\V1\pdf417.java:1118: error: code too large
public static String  _process_globals() throws Exception{

I tried zipping the modules into a b4xlib hoping to avoid the above error, but I am still getting the same result.

Is there a workaround without having to split the subs?

Thanks
iCAB
 

iCAB

Well-Known Member
Licensed User
Longtime User
Absolutely, that's why I mentioned: "Is there a workaround without having to split the subs?"
I am also facing the issue in both debug and release modes.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The first thing to do would be to correct the source so that all those warnings disappear.

In particular, those relating to the instruction lines written in the Process_Globals of the PDF417 code module, from line 87 to 1018.

Create a Public Sub Init and move them to this.

Indeed, the first thing to do would be to tell the author (@Johan Schoeman) to do it ?
EDIT: Done.
 
Last edited:
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
The first thing to do would be to correct the source so that all those warnings disappear.

In particular, those relating to the instruction lines written in the Process_Globals of the PDF417 code module, from line 87 to 1018.

Create a Public Sub Init and move them to this.

Indeed, the first thing to do would be to tell the author (@Johan Schoeman) to do it ?
EDIT: Done.
There are many apps in the forum that can create barcodes far more efficiently than using this old app of mine.

Check the B4J forum for the same project. Somewhere in that thread someone has split some of the subs into multiple subs to get around the compiler error.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Thanks all for your replies.

My question is this: how come the original library worked just fine and now the exact same code doesn't work?
If it wasn't for the fact that the library defaulted to the external folder, all would have been fine.

If the original library worked, why creating a b4xlib library won't work?
 
Last edited:
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Do you have an extremely large sub (one sub hundreds of lines), what's in your process globals???

If you have a large sub, break it up I to smaller subs...
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
I have just downloaded project from this link:


Compiles perfectly - I have set the target sdk from 14 (original) to 22 and have no problem compiling it.

Scan QR code in image below - it should say "ICAB"
1.png


2.png
 
Last edited:
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Hi John,

Thanks for your reply.
I just tried the same thing (but I also believe that we can no longer upload to the play store with TargetSDK < 30 )

1638293885546.png
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Hi John,

Thanks for your reply.
I just tried the same thing (but I also believe that we can no longer upload to the play store with TargetSDK < 30 )

John what happens if you change the compilation mode from Release (obfuscated) to just Release?
I bet you the sub that B4A line: 1521 refers that is in your screenshot above is a HUGE sub, it wouldn't surprise me if it worked in just normal Release mode.

Just a logical guess, but I still think that breaking that sub down would fix the issue...
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
John what happens if you change the compilation mode from Release (obfuscated) to just Release?

  1. All except QRCode and PDF417 compile in all modes
  2. QRCode compiles in Release & Release(obfuscated) but not in Debug mode
  3. PDF417 doesn't compile in any
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
  1. All except QRCode and PDF417 compile in all modes
  2. QRCode compiles in Release & Release(obfuscated) but not in Debug mode
  3. PDF417 doesn't compile in any
I'll try it myself, brb...
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
So @iCAB
I too get the line error, I received the error in both Debug and Release (obfuscated) modes. It assembles and works perfect for me in Release mode.
1638311690108.png


Java has a size limit of 65535 characters for a method.
Public Sub DrawAztecCode is way too big, it's almost at 65535 characters in size, it needs splitting up. If I were you I would start with removing all this commented out text to see what happens...
 
Last edited:
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
I too get the line error, I received the error in both Debug and Release (obfuscated) modes. It assembles and works perfect for me in Release mode.
@Peter Simpson , thanks for all your help!
I am removing the Aztec module as it is not needed for my project.

The only issue left is the QRCode module in debug mode. I am hoping that someone has a B4A version of the code in here:
https://www.b4x.com/android/forum/t...e93-ean8-ean13-and-code128.57248/#post-365230
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
What's wrong with using Erels QR code generator for that???

 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Thanks guys, I will give both a try.

But I always used this library and it always worked perfectly for any size QRcode. I guess I'm in love with it :).
 
Upvote 0
Top