Open BradF-99 opened 3 years ago
So as soon as you set DisableAutoFocus to false, it stops crashing?
So as soon as you set DisableAutoFocus to false, it stops crashing?
Yes, if I specify DisableAutoFocus as false, or don't specify it at all, it doesn't crash.
So as soon as you set DisableAutoFocus to false, it stops crashing?
Yes, if I specify DisableAutoFocus as false, or don't specify it at all, it doesn't crash.
Same issue here. Setting to true causing app to crash.
Still an issue in 3.0.1-beta2.
When DisableAutofocus is set to true in the MobileBarcodeScanningOptions object, and the ZXingScannerView is initialised using said options, the app crashes with a Java.Lang.RuntimeException. I've tested this on a device running Android 8.0 and 9.0, as well as devices using iOS 14 - no errors occur on iOS when autofocus is disabled. Additionally, the exception does not occur in the Android emulator, and occurs regardless of solution configuration (Debug / Release). From reading the stacktrace it looks like it could be more of an Android Camera API problem than a ZXing or Xamarin problem. Currently using package version 2.4.1. for both ZXing.Net.Mobile and ZXing.Net.Mobile.Forms - however the error occurs on 3.0.0-beta5 as well.
Full stack-trace from Raygun is as follows:
``` Message: setParameters failed Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod(Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) in <19d895adbfe34040ab0b2415f91ffd34> Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod(System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) in <19d895adbfe34040ab0b2415f91ffd34> Android.Hardware.Camera.SetParameters(Android.Hardware.Camera+Parameters params) in <8e4439c6b3c94bdc80169c2637f8ce91> ZXing.Mobile.CameraAccess.CameraController.ApplyCameraSettings() in <819b29aa6d91462699e19a679be55a44> ZXing.Mobile.CameraAccess.CameraController.SetupCamera() in <819b29aa6d91462699e19a679be55a44> ZXing.Mobile.CameraAccess.CameraAnalyzer.SetupCamera() in <819b29aa6d91462699e19a679be55a44> ZXing.Mobile.ZXingSurfaceView.SurfaceCreated(Android.Views.ISurfaceHolder holder) in <819b29aa6d91462699e19a679be55a44> System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0(System.Object state) in
Android.App.SyncContext+<>c__DisplayClass2_0.b__0() in <8e4439c6b3c94bdc80169c2637f8ce91>
Java.Lang.Thread+RunnableImplementor.Run() in <8e4439c6b3c94bdc80169c2637f8ce91>
Java.Lang.IRunnableInvoker.n_Run(System.IntPtr jnienv, System.IntPtr native__this) in <8e4439c6b3c94bdc80169c2637f8ce91>
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.45(intptr,intptr)
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: setParameters failed
android.hardware.Camera.native_setParameters(Native Method)
android.hardware.Camera.setParameters in Camera.java:2118
crc6480997b3ef81bf9b2.ZXingSurfaceView.n_surfaceCreated(Native Method)
crc6480997b3ef81bf9b2.ZXingSurfaceView.surfaceCreated in Unknown Source
android.view.SurfaceView.updateSurface in SurfaceView.java:800
android.view.SurfaceView$2.onPreDraw in SurfaceView.java:187
android.view.ViewTreeObserver.dispatchOnPreDraw in ViewTreeObserver.java:991
android.view.ViewRootImpl.performTraversals in ViewRootImpl.java:3019
android.view.ViewRootImpl.doTraversal in ViewRootImpl.java:1888
android.view.ViewRootImpl$TraversalRunnable.run in ViewRootImpl.java:8511
android.view.Choreographer$CallbackRecord.run in Choreographer.java:949
android.view.Choreographer.doCallbacks in Choreographer.java:761
android.view.Choreographer.doFrame in Choreographer.java:696
android.view.Choreographer$FrameDisplayEventReceiver.run in Choreographer.java:935
android.os.Handler.handleCallback in Handler.java:873
android.os.Handler.dispatchMessage in Handler.java:99
android.os.Looper.loop in Looper.java:214
android.app.ActivityThread.main in ActivityThread.java:7050
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run in RuntimeInit.java:494
com.android.internal.os.ZygoteInit.main in ZygoteInit.java:965
```