Android Question Problem using ZxingLibrary together with Code128.class

Air

Member
Licensed User
Longtime User
Hello,

long time i used the Codexxx.class from this thread, (wich is using the additional core3.2.1-library) to create my Code128 manually by typing the number and the ClassModule generates the Label, because i had no labels to scan available.

Now, sometimes it is possible to use a scanner to scan a label and get the number for Code128, wich will be stored in a database.


So i decidet to use this ZXingLibrary V1.06 to have the option to scan labels also.


My Problem is:
I can not use both (Library and Class-Module) in the same Project, because while compiling, i get the error, that the BarcodeFormat is defined multiple times


Error in C:\Android\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63663735648000\dex_v1\jhsicezxing1.zip:classes.dex:
Type com.google.zxing.BarcodeFormat is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63663735648000\dex_v1\jhsicezxing1.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-core-3.2.1-63583023310000\dex_v1\core-3.2.1.zip:classes.dex
Compilation failed

Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Android\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63663735648000\dex_v1\jhsicezxing1.zip:classes.dex

Caused by: com.android.tools.r8.internal.f: Type com.google.zxing.BarcodeFormat is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63663735648000\dex_v1\jhsicezxing1.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-core-3.2.1-63583023310000\dex_v1\core-3.2.1.zip:classes.dex




My Question:
If i have no label to scan, and have to manually save the number of the code128 in my database, can i use somehow the ZXing-Library also, to create a label for me?
Because than i can get rid of the ClassModule wich did this before.

I found only threads to scan labels with this Library, but none to create a code128-label


Maybe someone can help me with this problem.
Thanks
 

drgottjr

Expert
Licensed User
Longtime User
it wouldn't be a disaster to use 1 activity for generating and 1 for scanning.

in any case, you can add scanning capability to your generator class. there are a couple of ways to handle this. zxing has a dedicated code128 reader and a more generic 1D reader. it is not difficult to extend the class to include one or the other. or both.
one issue will be how you intend to capture the code128 and pass it to the reader... you will have to write that code to handle the camera and bitmap.

it might also be possible to take your code128 class and add it to the scanning app and recompile. the whole point of a class is being able to re-use it. the icefairy wrap has, what, 9 downloads. i'm not going to go through all of them for you, but i can tell you it would definitely be easy to extend your generator class to include reading, and it is probably easy to add your generator class to the icefairy scanning app.

the code relating to zxing is simple enough: 1 method to generate, 1 method to scan. the problem for you is to decide how you're going to get a scanned image to zxing for decoding. you either have to re-write your generator app (to handle a camera or a camera intent) or you have to re-write the icefairy app to generate a code128.
how do you think you want to move forward on this? (by the way, let's not forget zxing master johan schoeman for his seminal work in this matter. i'm sure he is still basking in the glory of his country's rugby world championship.)
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
This should be workable in B4A to create code 128 barcodes. Just the canvas part in B4J that needs to be adapted to suite B4A

 
  • Like
Reactions: Air
Upvote 0

Air

Member
Licensed User
Longtime User
This should be workable in B4A to create code 128 barcodes. Just the canvas part in B4J that needs to be adapted to suite B4A

Thanx, i will give it a try.
Meanwhile i am using the old Code128.class for manual typing the Codenumber to create a Code128-Label. This works savely for some Years now ;-).

I also found the 1D and 2D Barcode Scanner with ZBAR wich is also from you. If this one isn´t a wrapper from ZXing, i will try it with this one also.

I am not that professional, to make my own library or a wrapper of somone elses library.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
look, here's a simple code128 generator/scanner.
 

Attachments

  • code128.zip
    10.6 KB · Views: 136
  • Like
Reactions: Air
Upvote 0

Air

Member
Licensed User
Longtime User
This should be workable in B4A to create code 128 barcodes. Just the canvas part in B4J that needs to be adapted to suite B4A

After a few adjustments, especially since I'm still using AppCombat in my app, I was able to successfully install both the Code128.class and the ZLab.Library. It works exactly as I hoped. Thank you for the help.
 
Upvote 0

Air

Member
Licensed User
Longtime User
look, here's a simple code128 generator/scanner.
I will also test your code. Since I would like to convert my app to B4A-Pages soon, which has now become quite extensive, I can incorporate that in one go. My big thanks to you too for the help.
 
Upvote 0
Top