Open kamazheng opened 3 years ago
We have the same issue on the 3.0.0 beta.
Are there any steps how to reproduce it ? We have logs from prod, but couldn't reproduce it locally
I have the same issue on multiple devices and multiple Android versions. I have yet to reproduce it deliberately, but according to the users it tends to happen mostly when the device orientation changes.
There are also multiple other reports of the same problem here within the issues list (#1003, #924) that have (up until I last looked) not been addressed other than to suggest the 3.x version(s) - all of which still display the same problem.
I also have this issue. Multiple devices and multiple crashes per day on each. One user has orientation locked and is still experiencing the crash. I am unable to reproduce it, seems random.
Is this product even supported anymore? I havn't seen any updates for a long time. I now also get this exact error but it is hard to replicate.
{Java.Lang.RuntimeException: getParameters failed (empty parameters)
at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <00c315a988634383b446eff646084784>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <00c315a988634383b446eff646084784>:0
at Android.Hardware.Camera.GetParameters () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Hardware.Camera.cs:4857
at ZXing.Mobile.CameraAccess.CameraController.ApplyCameraSettings () [0x00033] in <819b29aa6d91462699e19a679be55a44>:0
at ZXing.Mobile.CameraAccess.CameraController.RefreshCamera () [0x00010] in <819b29aa6d91462699e19a679be55a44>:0
at ZXing.Mobile.CameraAccess.CameraAnalyzer.RefreshCamera () [0x00001] in <819b29aa6d91462699e19a679be55a44>:0
at ZXing.Mobile.ZXingSurfaceView.SurfaceChanged (Android.Views.ISurfaceHolder holder, Android.Graphics.Format format, System.Int32 wx, System.Int32 hx) [0x0006b] in <819b29aa6d91462699e19a679be55a44>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Java.Lang.IRunnable.cs:84
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.53(intptr,intptr)
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: getParameters failed (empty parameters)
at android.hardware.Camera.native_getParameters(Native Method)
at android.hardware.Camera.getParameters(Camera.java:2177)
at crc6480997b3ef81bf9b2.ZXingSurfaceView.n_surfaceChanged(Native Method)
at crc6480997b3ef81bf9b2.ZXingSurfaceView.surfaceChanged(ZXingSurfaceView.java:92)
at android.view.SurfaceView.updateSurface(SurfaceView.java:826)
at android.view.SurfaceView.setFrame(SurfaceView.java:444)
at android.view.View.layout(View.java:22419)
at crc643f46942d9dd1fff9.ViewRenderer_2.n_onLayout(Native Method)
at crc643f46942d9dd1fff9.ViewRenderer_2.onLayout(ViewRenderer_2.java:47)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:37)
at crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_onLayout(Native Method)
at crc643f46942d9dd1fff9.Platform_DefaultRenderer.onLayout(Platform_DefaultRenderer.java:72)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:37)
at crc643f46942d9dd1fff9.PageRenderer.n_onLayout(Native Method)
at crc643f46942d9dd1fff9.PageRenderer.onLayout(PageRenderer.java:72)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:37)
at crc64720bb2db43a66fe9.NavigationPageRenderer.n_onLayout(Native Method)
at crc64720bb2db43a66fe9.NavigationPageRenderer.onLayout(NavigationPageRenderer.java:65)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:37)
at crc64720bb2db43a66fe9.Platform_ModalContainer.n_onLayout(Native Method)
at crc64720bb2db43a66fe9.Platform_ModalContainer.onLayout(Platform_ModalContainer.java:53)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at crc643f46942d9dd1fff9.PlatformRenderer.n_onLayout(Native Method)
at crc643f46942d9dd1fff9.PlatformRenderer.onLayout(PlatformRenderer.java:63)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:1067)
at android.view.View.layout(View.java:22422)
at android.view.ViewGroup.layout(ViewGroup.java:6594)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3417)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2884)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1932)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8585)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:988)
at android.view.Choreographer.doCallbacks(Choreographer.java:765)
at android.view.Choreographer.doFrame(Choreographer.java:700)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7179)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
One way we where able to duplicate is: 1) Go to system settings > Apps > YourApp. From there remove your camera permissions. Or on a fresh install of app. 2) Start your app
At this point and before the scanner opens we would CheckAndRequestCameraPermissions using Xamarin.Essentials. If they have yet to Accept or Deny permissions it will prompt them to do so. Once they Accept we then would go and do our normal camera/scanner startup. At this point it would crash. if you would go in and try it again it would work being they already accepted the permissions.
Our solution was to add a Delay of 100 milliseconds after they accepted the permissions and before they open the camera.
await Task.Delay(100);
So it appears for us that if the camera opens up to quickly after they accept the permissions it would fail. This was occuring on a Pixel with Android 11.
5 years this issue persists, and it's not acceptable for our applications to CRASHE violently in production :-( As nobody move... so I will.
Related Issues : #728 #924 #1011 (and maybe more ? I stopped my search here...)
A pull request https://github.com/Redth/ZXing.Net.Mobile/pull/1002 has been kindly submitted by @rdfordatascience-ops (thanks ;-)) but has never been merged, accepted or included in a new version... It's not a "clean" solution, but it's better than CRASHES.
So :
https://www.nuget.org/packages/Respawnsive.ZXing.Net.Mobile/ https://www.nuget.org/packages/Respawnsive.ZXing.Net.Mobile.Forms/
-> 1 hour, that's all what it takes to me...
So I hope this will be usefull for some peoples... because the "real production world" is not focused on MAUI (not yet at least ;-)) Regards
I am also seeing this happening I haven't looked at causes at all but this IS a issue that needs looking into
Error : Unhandled Exception System . Exception : CurrentDom ainOnUnhandledExCeption ---> Java . Lang . RuntimeException : getParameters failed ( empty parameters ) at Java . Interop . JniEnvironment + in stanceMethods . CallObjectMethod ( Java . Interop . JniObjectReference nstance , Java . Interop . JniMethodInfo method , Java . Interop . JniArgumentValue args )[Ox0006e] in :0 at JavaInterop . JniPeerMe mbers + JnilnstanceMethods . InvokeVirtualObjectMethod ( System . String encodedMember , Java . Interop . lJavaPeerable self , Java . Interop . JniArgumentValue parameters )[Ox0002a] in :0 at Android . Hardware . Camera . GetPara meters ()[Ox0000a] in <0052a949de514c3fa49f58e679d0986c>:0 at ZXing . Mobile . CameraAccess . Cam eraControler . ApplyCameraSettings ()[0x00033] in <819b29aa6d91462699e19a679be55a44>:0 at ZXing . Mobile . CameraAccess . C ameraController . RefreshCamera ()