QR-Codescanner ArrayIndexOutOfBoundsException


#1

I’m trying to implement QR-CodeScanner on my application, so I went to barcode-scanner docs and follow instructions:

http://ionicframework.com/docs/native/barcode-scanner/ and
npm install --save @ionic-native/barcode-scanner

After, import on app.module and inject on constructor page.

constructor(
  private navCtrl: NavController, 
  private bcScan: BarcodeScanner
) { }

I have a button like this:

<ion-buttons right>
  <button ion-button icon-only (click)='onScan()'>
    <ion-icon name='camera'></ion-icon>
  </button>
</ion-buttons>

and onScan function:

onScan() {
  this.bcScan.scan().then( data => {
    console.log(data);
  }, err => {
    console.log(err);
  });
}

After I run the app and press camera button shows android error message Unfortunately qr-scanner has stopped. qr-scanner is my application’s name.

I opened android monitor to inspect the applications and I got this error:

05-05 11:16:24.066 1810-2092/com.ionicframework.qrscanner420444 E/AndroidRuntime: FATAL EXCEPTION: Thread-14915
    Process: com.ionicframework.qrscanner420444, PID: 1810
    java.lang.ArrayIndexOutOfBoundsException: length=1382400; index=1383479
    at com.google.zxing.client.android.camera.CameraManager.buildLuminanceSource(CameraManager.java:364)
    at com.google.zxing.client.android.DecodeHandler.decode(DecodeHandler.java:92)
    at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:60)
    at android.os.Handler.dispatchMessage(Handler.java:111)
    at android.os.Looper.loop(Looper.java:194)
    at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:110)

I can’t find anything to solve my problem.