-
Notifications
You must be signed in to change notification settings - Fork 16
Surface had no valid native window. on barcodeView.start() #13
Comments
This comment has been minimized.
This comment has been minimized.
Yes, also I added the BarcodeView as an observer to the lifecycle in onActivityCreated as you have on https://github.com/brightec/KBarcode/wiki |
This exception does appear to be caused by affectively calling I had previously thought the library handled calling I will create a pull request soon which will address this issue. For your case @OmarJoya, you are right that marshmallow is the differing factor. It appears that permissions dialogs behave differently between M and Q (not sure exactly for each version in between). On M the permissions dialog causes |
…nables us to check and not start the camera again if it is currently opening. Added tests which check the new behavioural changes.
Pull request has been approved and merged. |
does this last merge contain the fix?, I'm now using the kbarcode version 1.0.2, but seems the problem is not solved |
We are yet to do a release with this fix in. We had a few other things to get done before publishing the code. I will post again on this issue once we have done that. |
We have now done a release which includes this fix. |
Once I grant the CAMERA permissions barcodeView.start() throws an error
On Android Marshmallow is not needed call to start but on Android Pie
I want to know if there is a way to know if the barcode is already started to avoid calling .start()
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.centinal.ivs.internal.debug, PID: 17159
java.lang.IllegalArgumentException: Surface was abandoned
at android.hardware.camera2.utils.SurfaceUtils.getSurfaceSize(SurfaceUtils.java:70)
at android.hardware.camera2.params.OutputConfiguration.(OutputConfiguration.java:97)
at android.hardware.camera2.params.OutputConfiguration.(OutputConfiguration.java:71)
at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureSession(CameraDeviceImpl.java:474)
at uk.co.brightec.kbarcode.camera.Camera2Source.createCaptureSession$kbarcode_release(Camera2Source.kt:121)
at uk.co.brightec.kbarcode.camera.Camera2Source$start$1.onOpened(Camera2Source.kt:55)
at android.hardware.camera2.impl.CameraDeviceImpl$1.run(CameraDeviceImpl.java:134)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.hardware.camera2.legacy.LegacyExceptionUtils$BufferQueueAbandonedException
at android.hardware.camera2.legacy.LegacyExceptionUtils.throwOnError(LegacyExceptionUtils.java:64)
at android.hardware.camera2.legacy.LegacyCameraDevice.getSurfaceSize(LegacyCameraDevice.java:540)
at android.hardware.camera2.utils.SurfaceUtils.getSurfaceSize(SurfaceUtils.java:68)
at android.hardware.camera2.params.OutputConfiguration.(OutputConfiguration.java:97)
at android.hardware.camera2.params.OutputConfiguration.(OutputConfiguration.java:71)
at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureSession(CameraDeviceImpl.java:474)
at uk.co.brightec.kbarcode.camera.Camera2Source.createCaptureSession$kbarcode_release(Camera2Source.kt:121)
at uk.co.brightec.kbarcode.camera.Camera2Source$start$1.onOpened(Camera2Source.kt:55)
at android.hardware.camera2.impl.CameraDeviceImpl$1.run(CameraDeviceImpl.java:134)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
The text was updated successfully, but these errors were encountered: