juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
981 stars 695 forks source link

[BUG] Crash com.journeyapps.barcodescanner.Decoder.decode [from version 0.7.0] #529

Open svprdga opened 2 years ago

svprdga commented 2 years ago

Describe the bug Some of my Android users are experiencing crashes. I couldn't reproduce it by myself.

The issue seems to arise when detecting codes.

This issue is new and started happening from plugin version 0.7.0.

For now I'm just reverting the version to 0.6.1.

Stack trace:

Fatal Exception: java.lang.NoSuchMethodError: No interface method sort(Ljava/util/Comparator;)V in class Ljava/util/List; or its super classes (declaration of 'java.util.List' appears in /system/framework/core-libart.jar)
       at com.google.zxing.qrcode.detector.FinderPatternFinder.selectBestPatterns(FinderPatternFinder.java)
       at com.google.zxing.qrcode.detector.FinderPatternFinder.find(FinderPatternFinder.java)
       at com.google.zxing.qrcode.detector.Detector.detect(Detector.java)
       at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java)
       at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java)
       at com.google.zxing.MultiFormatReader.decodeWithState(MultiFormatReader.java)
       at com.journeyapps.barcodescanner.Decoder.decode(Decoder.java)
       at com.journeyapps.barcodescanner.Decoder.decode(Decoder.java)
       at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java)
       at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java)
       at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:148)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Device (please complete the following information):

vietlinhtspt commented 2 years ago

I faced same issue

vietlinhtspt commented 2 years ago

I have found that qr_code_scanner conflic with one of that libraries ONLY in release app flutter_downloader: ^1.7.3 path_provider: ^2.0.9 permission_handler: ^9.2.0 device_info_plus: ^3.2.2 android_path_provider: ^0.3.0

vietlinhtspt commented 2 years ago

[Updated] when I add a new screen, it still crash :(

svprdga commented 2 years ago

@vietlinhtspt the issue I described is caused by ZXing, the underlying QR scanner library that this plugin uses in Android.

If you have a different error I think it's better to open a dedicated issue with a proper error summary, and then have a conversarion about it there. This way we can keep this issue tracker clean and ordered.

vietlinhtspt commented 2 years ago

Yep, I have spend 2 days to try, the error occur when I add some libraries or some line of code or stateful widget :). I think it not stable to use for products now. So I have used another package(mobile_scanner), I think you can try it, I can custom like qr_code_scanner and it is faster (Depend on my sense)

@vietlinhtspt the issue I described is caused by ZXing, the underlying QR scanner library that this plugin uses in Android.

If you have a different error I think it's better to open a dedicated issue with a proper error summary, and then have a conversarion about it there. This way we can keep this issue tracker clean and ordered.

karimi1064 commented 2 years ago

I faced same issue

zopagaduanjr commented 1 year ago

Also exists on qr_code_scanner: 0.5.2

affects vivo, OPPO, and samsung

exists on OS: Android 5 & 6

svprdga commented 1 year ago

For those interested, I have forked the plugin and I have downgraded the Zxing lib to a point where it doesn't fail, you can use it with:

  qr_code_scanner:
    git:
      url: git@github.com:svprdga/qr_code_scanner.git
      ref: downgrade_zxing
10hyh01 commented 1 year ago

Add following config to build.gradle to support new language API that fixed this issue for me. `android { ...... compileOptions { coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } }

dependencies { ...... coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' }`