phonegap / phonegap-plugin-barcodescanner

cross-platform BarcodeScanner for Cordova / PhoneGap
MIT License
1.27k stars 1.41k forks source link

App crashes just after camera preview is shown (Android 6) #609

Open Giriton opened 6 years ago

Giriton commented 6 years ago

Expected Behaviour

Camera preview opens, i see myself (in front camera) until I use a QR code.

Actual Behaviour

Camera preview opens, i see myself (in front camera) for 0.5 second, the whole app crashes.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 6.0

Cordova CLI version and cordova platform version

cordova --version : 7.1.0
cordova platforms : android 6.3.0

Plugin version

cordova plugin version | grep phonegap-plugin-barcodescanner : 7.0.2

Logs taken while reproducing problem

(full logcat with other info about camera and formats selected are in attached here errorLog.txt )

FATAL EXCEPTION: Thread-496
Process: com.our.packagename.ui, PID: 8391
java.lang.ArrayIndexOutOfBoundsException: src.length=460800 srcPos=461160 dst.length=810000 dstPos=46800 length=1200
    at java.lang.System.arraycopy(Native Method)
    at com.google.zxing.PlanarYUVLuminanceSource.getMatrix(PlanarYUVLuminanceSource.java:101)
    at com.google.zxing.common.HybridBinarizer.getBlackMatrix(HybridBinarizer.java:70)
    at com.google.zxing.BinaryBitmap.getBlackMatrix(BinaryBitmap.java:85)
    at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java:77)
    at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:171)
    at com.google.zxing.MultiFormatReader.decodeWithState(MultiFormatReader.java:85)
    at com.google.zxing.client.android.DecodeHandler.decode(DecodeHandler.java:96)
    at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:60)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:110)
macdonst commented 6 years ago

@Giriton yeah, that crash is coming from deep inside the ZXing library the plugin uses for decoding barcodes.

Giriton commented 6 years ago

@macdonst I see, thank you for clarification. As far as I found out, this plugin uses barcodescanner-release-2.1.5.aar form here https://github.com/EddyVerbruggen/barcodescanner-lib-aar , correct?

On that page, @EddyVerbruggen says: Update any source files as needed (current version is: https://github.com/zxing/zxing/releases/tag/BS-4.7.6)

However that version 4.7.6 is from September 2016. Current newest version 4.7.7 is from October 2017. So my question is, is it possible to perhaps update version of BS (Barcode Scanner) used from ZXing to current 4.7.7 ?

In ZXyng, there is a commit that did something around this very row, where the error appears from: https://github.com/zxing/zxing/commit/2f11529aa35e01354f9036c2aa7747ab23a604ef#diff-3ea115340f67fb0e31e24e4cd9ae7582

So updating Barcode Scanner.aar would update also ZXyng engine used in Barcode Scanner.aar and if problem persist, I know it is still not fixed problem of ZXyng. In that case I can open issue there. Until then, I can not be sure whether the mentioned commit was or was not included in currently used 4.7.6.

Hope it makes a sense :-) What do you think?

NBAMj commented 6 years ago

One of my users is facing a similar issue with ZXing library and the crash log looks similar to what you have mentioned. Android Version is 6.0

Would love to see if there is any update on this issue.

bennuer commented 6 years ago

I have detected a similar error on a device with android 7.

Camera error after opening.

jarekskuder commented 6 years ago

Same here, only my app crashes immediately after i open scanner

fttx commented 6 years ago

same here

michielsebille commented 6 years ago

Also on windows 8.1 this issue

bpetty-formfast commented 5 years ago

@michielsebille , as for the comment about Windows, we were getting the same behavior but were able to get around it by creating a published version. In VS go to Project/Store/Create App Packages. A regular release build would pop up and instantly crash, but having not looked at an error log I can't say if it is related.

Alipric2019 commented 5 years ago

Same here, too.

CeloGomesBR commented 4 years ago

I really need this barcode scanner works on Android 6, at least!!!

CristianoGil commented 4 years ago

I have same problem.