mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

Failed to set CONTINOUS_PICTURE #206

Closed masewo closed 4 years ago

masewo commented 4 years ago

With the latest version 3.0.0-dev.1 I get the following error when trying to scan a barcode on an Android emulator:

E/ZXing   (32043): Failed to set CONTINOUS_PICTURE
E/ZXing   (32043): java.lang.RuntimeException: setParameters failed
E/ZXing   (32043):  at android.hardware.Camera.native_setParameters(Native Method)
E/ZXing   (32043):  at android.hardware.Camera.setParameters(Camera.java:2117)
E/ZXing   (32043):  at de.mintware.barcode_scan.ZXingAutofocusScannerView.setupCameraPreview(ZXingAutofocusScannerView.kt:17)
E/ZXing   (32043):  at me.dm7.barcodescanner.core.CameraHandlerThread$1$1.run(CameraHandlerThread.java:31)
E/ZXing   (32043):  at android.os.Handler.handleCallback(Handler.java:883)
E/ZXing   (32043):  at android.os.Handler.dispatchMessage(Handler.java:100)
E/ZXing   (32043):  at android.os.Looper.loop(Looper.java:214)
E/ZXing   (32043):  at android.app.ActivityThread.main(ActivityThread.java:7356)
E/ZXing   (32043):  at java.lang.reflect.Method.invoke(Native Method)
E/ZXing   (32043):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/ZXing   (32043):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Even when commenting out following lines there is no scan result:

//        cameraWrapper?.mCamera?.parameters?.let { parameters ->
//            try {
//                parameters.focusMode = Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE
//                cameraWrapper.mCamera.parameters = parameters
//            } catch (ex: Exception) {
//                Log.e("ZXing", "Failed to set CONTINOUS_PICTURE", ex)
//                callbackFocus = true
//            }
//        }
devtronic commented 4 years ago

Can you please provide details about the AVD?

masewo commented 4 years ago

Sure:

Name: Pixel_3_API_29

CPU/ABI: Google Play Intel Atom (x86_64)

Target: google_apis_playstore [Google Play] (API level 29)

Skin: pixel_3

SD Card: 512M

fastboot.chosenSnapshotFile: 

runtime.network.speed: full

hw.accelerometer: yes

hw.device.name: pixel_3

hw.lcd.width: 1080

hw.initialOrientation: Portrait

image.androidVersion.api: 29

tag.id: google_apis_playstore

hw.mainKeys: no

hw.camera.front: emulated

avd.ini.displayname: Pixel 3 API 29

hw.gpu.mode: auto

hw.ramSize: 1536

PlayStore.enabled: true

fastboot.forceColdBoot: no

hw.cpu.ncore: 4

hw.keyboard: yes

hw.sensors.proximity: yes

hw.dPad: no

hw.lcd.height: 2160

vm.heapSize: 256

skin.dynamic: yes

hw.device.manufacturer: Google

hw.gps: yes

hw.audioInput: yes

image.sysdir.1: system-images\android-29\google_apis_playstore\x86_64\

showDeviceFrame: yes

hw.camera.back: virtualscene

AvdId: Pixel_3_API_29

hw.lcd.density: 440

hw.arc: false

hw.device.hash2: MD5:xxxxxx

fastboot.forceChosenSnapshotBoot: no

fastboot.forceFastBoot: yes

hw.trackBall: no

hw.battery: yes

hw.sdCard: yes

tag.display: Google Play

runtime.network.latency: none

disk.dataPartition.size: 6442450944

hw.sensors.orientation: yes

avd.ini.encoding: UTF-8

hw.gpu.enabled: yes
devtronic commented 4 years ago

That's not really a bug. The message occurs when the barcode was scanned, the scanner shuts down and zxing try to perform auto focus.

As you can see, the barcode is recognized:

But I'll remove the confusing message in the next release.