Android Question QrCOdes Read and Generate

Humberto

Active Member
Licensed User
Longtime User
I´m trying to write an APP the generate Qr Codes and I´m trying to use this two library CRZXing ( Version 2.00) and jhsicezxing1 ( version 1.00)

If I compile using one at the time both work well but when I setup both library I get this error

B4X:
B4A version: 5.50
Parsing code.    (0.01s)
Compiling code.    (0.07s)
   
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.00s)
Generating R file.    (0.85s)
Compiling generated Java code.    (1.27s)
Convert byte code - optimized dex.    Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/zxing/aztec/AztecDetectorResult;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
    at com.android.dx.command.dexer.Main.processClass(Main.java:685)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:596)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    at com.android.dx.command.dexer.Main.main(Main.java:199)
    at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting

Can someone help me ?

Thanks
 

Attachments

  • qr_codes_Encode_Decode.zip
    29.8 KB · Views: 370

DonManfred

Expert
Licensed User
Longtime User
Seems that both libraries are importing
com/google/zxing/aztec/AztecDetectorResult

You should decide which one you want to use. A or B.

Just my 2cent
 
Upvote 0

Humberto

Active Member
Licensed User
Longtime User
But each one do one thing, one read and the other generate the code.

There is a way to disable one for loading this library ?
 
Upvote 0

ivan.tellez

Active Member
Licensed User
Longtime User
You cant have the same lib imported more than one time.

In the forum are posted several libs also based on the zxing project. Some of them had both functions, scan and create codes.

Just use the search function in the forum.
 
Upvote 0

Humberto

Active Member
Licensed User
Longtime User

Attachments

  • QrCode_Encode_Scan.zip
    57.9 KB · Views: 380
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
I tried this two libraries after tested many solutions posted here, but unfortunately didn´t work together

I use this two solutions that works together and I post the sample project here for someone who need too.

To read ZXingLib by icefairy333 - modified by Johan Schoeman
https://www.b4x.com/android/forum/t...other-1d-2d-barcodes.49084/page-3#post-346040

To draw QRCode.bas that you find in the post below
https://www.b4x.com/android/forum/t...ng-password-protected-qr-codes.60679/#content
You can also add QRCode.bas to Password Protected QR Codes. It should work too.
 
Upvote 0

Humberto

Active Member
Licensed User
Longtime User
Joahn

In "Qrcode.Bas" I tried to change the "shape" from "s" to "c" ( circle ) and the Qrcode doesn´t appear.

I also tried to change the "back color" and I could not see a change.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Joahn

In "Qrcode.Bas" I tried to change the "shape" from "s" to "c" ( circle ) and the Qrcode doesn´t appear.

I also tried to change the "back color" and I could not see a change.
In the project that you have posted in post #5 ? I might have stripped out some of the functionality in the "generate password protected qr codes" to make it simple. This should have the complete functionality for amongst others QR Codes (also PDF 417, Aztec Codes, etc)

https://www.b4x.com/android/forum/threads/qr-code-library.41408/#post-322509
 
Upvote 0
Top