Camera crashing in Android 11
See original GitHub issueStack Trace:
Java.Lang.RuntimeException: set display orientation failed
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0008e] in <1959115d56f8444789986cf39185638c>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001f] in <1959115d56f8444789986cf39185638c>:0
at Android.Hardware.Camera.SetDisplayOrientation (System.Int32 degrees) [0x00018] in /Users/builder/azdo/_work/2/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Hardware.Camera.cs:5039
at GoogleVisionBarCodeScanner.CameraPreview.SetOrientation () [0x0003d] in <929ca9ff04df47ad86680b7a3455a351>:0
at GoogleVisionBarCodeScanner.CameraPreview.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00043] in <929ca9ff04df47ad86680b7a3455a351>:0
at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00008] in /Users/builder/azdo/_work/2/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Views.ViewGroup.cs:3873
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.43(intptr,intptr,bool,int,int,int,int)
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: set display orientation failed
at android.hardware.Camera.setDisplayOrientation(Native Method)
at crc6406d57bc67a4dd4fc.CameraPreview.n_onLayout(Native Method)
at crc6406d57bc67a4dd4fc.CameraPreview.onLayout(CameraPreview.java:62)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at crc643f46942d9dd1fff9.ViewRenderer_2.n_onLayout(Native Method)
at crc643f46942d9dd1fff9.ViewRenderer_2.onLayout(ViewRenderer_2.java:47)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
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:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
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:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
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:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
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:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at crc643f46942d9dd1fff9.PlatformRenderer.n_onLayout(Native Method)
at crc643f46942d9dd1fff9.PlatformRenderer.onLayout(PlatformRenderer.java:63)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:1225)
at android.view.View.layout(View.java:24475)
at android.view.ViewGroup.layout(ViewGroup.java:7383)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:4260)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3695)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
at android.view.Choreographer.doCallbacks(Choreographer.java:809)
at android.view.Choreographer.doFrame(Choreographer.java:744)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8587)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
I have an app that uses Prism that has a TabbedPage. From the tabpage I’m opening a page with the BarcodeScanner and then from there I’m opening another page and from there I’m accessing MediaPicker.CaptureAsync to open Camera app for capturing a picture. When I’m returning to the page after clicking the picture, I’m getting this crash
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
10 Simple Ways to Fix Camera App Crashing or Not Working ...
10 Simple Ways to Fix Camera App Crashing or Not Working on Android mobile · Reboot your device · Check the permissions for...
Read more >Camera randomly crashing after android 11 update
Camera is randomly crashing in normal camera app and Snapchat. If you wait a few minutes or restart the phone it will work...
Read more >Android 11 canners crash on 2XL - Google Pixel Community
So issue with the update to android 11. My camera app just keeps crashing. I'll start it, black screen with some controls comes...
Read more >[Camera Plugin] Application crashes and restarts when ...
When capturing an image with the Camera plugin it crashes everytime I take a picture and the app restarts. This only happens on...
Read more >Camera Crashing on Android 11 with IllegalStateException
I am opening the camera and file chooser in my application. It's working fine in all versions including android 11.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @petrdrabek
Thank you for helping. Just pull the request and publish the new version 6.1.0.1-pre.
Hi @abhinashpati
Let see if the problem still exist with the 6.1.0.1-pre.
For black screen issue, it may related to RequestFPS paramenter. Do not set it and the device will take default. maybe related to #101