Android Question ZXingLib by icefairy333 - modified by Johan Schoeman and B4xPages - Can't make it work

Oscarin

Member
My problem is that I am trying to use the library ZXingLib (1.06) with B4xPages, I have a main page (log in), a second page, where the user will scan the code, I put the code from the sample code on the second page but when I press the button to scan (a button that I created) but it just quits the process and I get a time-out on the logs

Result has arrived
** Activity (main) Pause event (activity is not paused). **
onActivityResult: wi is null
timedOut true
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **

The library is this one

PS
The sample code works fine, it's just when I use it in my app with B4xPages
 
Solution
My problem is that I am trying to use the library ZXingLib (1.06) with B4xPages, I have a main page (log in), a second page, where the user will scan the code, I put the code from the sample code on the second page but when I press the button to scan (a button that I created) but it just quits the process and I get a time-out on the logs

Result has arrived
** Activity (main) Pause event (activity is not paused). **
onActivityResult: wi is null
timedOut true
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **

The library is this one

PS
The sample...

Johan Schoeman

Expert
Licensed User
Longtime User
My problem is that I am trying to use the library ZXingLib (1.06) with B4xPages, I have a main page (log in), a second page, where the user will scan the code, I put the code from the sample code on the second page but when I press the button to scan (a button that I created) but it just quits the process and I get a time-out on the logs

Result has arrived
** Activity (main) Pause event (activity is not paused). **
onActivityResult: wi is null
timedOut true
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **

The library is this one

PS
The sample code works fine, it's just when I use it in my app with B4xPages
Take a look at the manifest file of the sample B4A project. You are missing entries in the manifest.
 
Upvote 0
Solution

james_sgp

Active Member
Licensed User
Longtime User
Hi, I`m having problems converting this to B4XPages, I`m getting the following error when compiling:

B4X:
B4A Version: 11.50
Parsing code.    (0.03s)
    Java Version: 11
Building folders structure.    (0.81s)
Running custom action.    (0.13s)
Compiling code.    (0.20s)
Compiling layouts code.    (0.04s)
Organizing libraries.    (0.01s)
    (AndroidX SDK)
Compiling resources    (0.22s)
Linking resources    (1.03s)
Compiling debugger engine code.    (3.98s)
Compiling generated Java code.    (4.70s)
Finding libraries that need to be dexed.    (0.03s)
Dex code    (3.94s)
Dex merge    Error
Error in C:\android-sdk\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63556466876000\dex_v1\jhsicezxing1.zip:classes.dex:
Type com.google.zxing.BarcodeFormat is defined multiple times: C:\android-sdk\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63556466876000\dex_v1\jhsicezxing1.zip:classes.dex, C:\android-sdk\tools\..\extras\b4a_local\unpacked-core-3.3.2-63659259650000\dex_v1\core-3.3.2.zip:classes.dex
Compilation failed
 

Attachments

  • Project.zip
    17 KB · Views: 233
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
A sample is here


Just change it (libs, code) for the library that you are using
 
Upvote 0

james_sgp

Active Member
Licensed User
Longtime User
A sample is here


Just change it (libs, code) for the library that you are using
Johan, Thanks for that, yes that example works. But I`m trying to use your library JHSICEZXING, and even if i transplant it into your example I get the same error about "Dex merge", see below:

B4X:
B4A Version: 11.50
Parsing code.    (0.03s)
    Java Version: 11
Building folders structure.    (0.24s)
Running custom action.    (0.10s)
Compiling code.    (0.14s)
Compiling layouts code.    (0.01s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.13s)
Linking resources    (0.66s)
Compiling debugger engine code.    (0.02s)
Compiling generated Java code.    (0.08s)
Finding libraries that need to be dexed.    (0.14s)
Dex code    (1.23s)
Dex merge    Error
Error in C:\android-sdk\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63556466876000\dex_v1\jhsicezxing1.zip:classes.dex:
Type com.google.zxing.BarcodeFormat is defined multiple times: C:\android-sdk\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63556466876000\dex_v1\jhsicezxing1.zip:classes.dex, C:\android-sdk\tools\..\extras\b4a_local\unpacked-core-3.3.2-63659259650000\dex_v1\core-3.3.2.zip:classes.dex
Compilation failed
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Johan, Thanks for that, yes that example works. But I`m trying to use your library JHSICEZXING, and even if i transplant it into your example I get the same error about "Dex merge", see below:

B4X:
B4A Version: 11.50
Parsing code.    (0.03s)
    Java Version: 11
Building folders structure.    (0.24s)
Running custom action.    (0.10s)
Compiling code.    (0.14s)
Compiling layouts code.    (0.01s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.13s)
Linking resources    (0.66s)
Compiling debugger engine code.    (0.02s)
Compiling generated Java code.    (0.08s)
Finding libraries that need to be dexed.    (0.14s)
Dex code    (1.23s)
Dex merge    Error
Error in C:\android-sdk\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63556466876000\dex_v1\jhsicezxing1.zip:classes.dex:
Type com.google.zxing.BarcodeFormat is defined multiple times: C:\android-sdk\tools\..\extras\b4a_local\unpacked-jhsicezxing1-63556466876000\dex_v1\jhsicezxing1.zip:classes.dex, C:\android-sdk\tools\..\extras\b4a_local\unpacked-core-3.3.2-63659259650000\dex_v1\core-3.3.2.zip:classes.dex
Compilation failed
Upload your project please.
 
Upvote 0
Top