xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Android] Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown. #2899

Open pauloortins opened 6 years ago

pauloortins commented 6 years ago

Description we are encountering the below error in production environment, the crash is causing in Android Version 6.0. We could't be able to reproduce and trace the error, here is the error log from App Center

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown. java.lang.Error: Java callstack: md51558244f76c53b6aeda52c8a337f2c37.ScrollViewRenderer.n_onDetachedFromWindow(Native Method) md51558244f76c53b6aeda52c8a337f2c37.ScrollViewRenderer.onDetachedFromWindow(ScrollViewRenderer.java:83) android.view.View.dispatchDetachedFromWindow(View.java:14571) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3073) android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4792) android.view.ViewGroup.removeAllViews(ViewGroup.java:4738) md58432a647068b097f9637064b8985a5e0.FragmentContainer.n_onDestroyView(Native Method) md58432a647068b097f9637064b8985a5e0.FragmentContainer.onDestroyView(FragmentContainer.java:41) android.support.v4.app.Fragment.performDestroyView(Fragment.java:2497) android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1503) android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750) android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:792) android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590) android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377) android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332) android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239) android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700) android.os.Handler.handleCallback(Handler.java:746) android.os.Handler.dispatchMessage(Handler.java:95) android.os.Looper.loop(Looper.java:148) android.app.ActivityThread.main(ActivityThread.java:5443) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

Version with issue: Android 6.0

Platform Target Frameworks:

iOS Android

Affected Devices:

Moto E with 4G LTE (2nd Gen)

your help is appreciated,

Regards

jassmith commented 6 years ago

What version of Xamarin.Forms? This looks like an issue that was already fixed in master.

pauloortins commented 6 years ago

3.0.0.482510

On Fri, Jun 8, 2018 at 7:31 PM, Jason Smith notifications@github.com wrote:

What version of Xamarin.Forms? This looks like an issue that was already fixed in master.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xamarin/Xamarin.Forms/issues/2899#issuecomment-395909575, or mute the thread https://github.com/notifications/unsubscribe-auth/ABF7K6SvCh1tjXu8rk_DoaMZ2isigTC6ks5t6vs5gaJpZM4UXJBM .

-- Paulo Ortins - www.pauloortins.com Tel.: (71) 9354-4577

jassmith commented 6 years ago

Do you have any more info about the state change thats happening here? A fragment is being destroyed and knowing what is going on in the app is going to be essential to figuring out whats going on. Java.Lang.Error tells us basically nothing. AppCenter has no other info?

paleicikas commented 6 years ago

The same for me (latest XF). I think this is happening at point of killing an app (could't be able to reproduce).

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.OnDetachedFromWindow () [0x0000c] in <7999cc4bd5664eca8a72469344172ca3>:0
  at Android.Views.View.n_OnDetachedFromWindow (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <263adecfa58f4c449f1ff56156d886fd>:0
  at (wrapper dynamic-method) System.Object.b982c500-c740-4528-8662-041e5df0ccb6(intptr,intptr)

Thread 2:
0   dalvik.system.VMStack.getThreadStackTrace(VMStack.java:-2)
1   java.lang.Thread.getStackTrace(Thread.java:1538)
2   java.lang.Thread.getAllStackTraces(Thread.java:1588)
3   com.microsoft.appcenter.crashes.Crashes.saveUncaughtException(Crashes.java:923)
4   com.microsoft.appcenter.crashes.WrapperSdkExceptionManager.saveWrapperException(WrapperSdkExceptionManager.java:50)
5   md58432a647068b097f9637064b8985a5e0.MasterDetailPageRenderer.n_onDetachedFromWindow(MasterDetailPageRenderer.java:-2)
6   md58432a647068b097f9637064b8985a5e0.MasterDetailPageRenderer.onDetachedFromWindow(MasterDetailPageRenderer.java:60)
7   android.view.View.dispatchDetachedFromWindow(View.java:17563)
8   android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3762)
9   android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:5524)
10  android.view.ViewGroup.removeAllViews(ViewGroup.java:5470)
11  md5f92e0daf340890c9667469657ee2ece8.ButtonRenderer.n_onClick(ButtonRenderer.java:-2)
12  md5f92e0daf340890c9667469657ee2ece8.ButtonRenderer.onClick(ButtonRenderer.java:95)
13  android.view.View.performClick(View.java:6300)
14  android.view.View$PerformClick.run(View.java:24941)
15  android.os.Handler.handleCallback(Handler.java:790)
16  android.os.Handler.dispatchMessage(Handler.java:99)
17  android.os.Looper.loop(Looper.java:164)
18  android.app.ActivityThread.main(ActivityThread.java:6523)
19  java.lang.reflect.Method.invoke(Method.java:-2)
20  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
21  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)

or

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.OnDetachedFromWindow () [0x0000c] in <7999cc4bd5664eca8a72469344172ca3>:0
  at Android.Views.View.n_OnDetachedFromWindow (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <263adecfa58f4c449f1ff56156d886fd>:0
  at (wrapper dynamic-method) System.Object.6079b69c-4314-4b2c-8331-0061626d78f9(intptr,intptr)

Thread 1:
0   dalvik.system.VMStack.getThreadStackTrace(VMStack.java:-2)
1   java.lang.Thread.getStackTrace(Thread.java:580)
2   java.lang.Thread.getAllStackTraces(Thread.java:522)
3   com.microsoft.appcenter.crashes.Crashes.saveUncaughtException(Crashes.java:923)
4   com.microsoft.appcenter.crashes.WrapperSdkExceptionManager.saveWrapperException(WrapperSdkExceptionManager.java:50)
5   md58432a647068b097f9637064b8985a5e0.MasterDetailPageRenderer.n_onDetachedFromWindow(MasterDetailPageRenderer.java:-2)
6   md58432a647068b097f9637064b8985a5e0.MasterDetailPageRenderer.onDetachedFromWindow(MasterDetailPageRenderer.java:60)
7   android.view.View.dispatchDetachedFromWindow(View.java:13643)
8   android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2838)
9   android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4399)
10  android.view.ViewGroup.removeAllViews(ViewGroup.java:4345)
11  md51558244f76c53b6aeda52c8a337f2c37.FormsAppCompatActivity.n_onDestroy(FormsAppCompatActivity.java:-2)
12  md51558244f76c53b6aeda52c8a337f2c37.FormsAppCompatActivity.onDestroy(FormsAppCompatActivity.java:80)
13  android.app.Activity.performDestroy(Activity.java:6169)
14  android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1141)
15  android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3799)
16  android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3830)
17  android.app.ActivityThread.access$1400(ActivityThread.java:156)
18  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
19  android.os.Handler.dispatchMessage(Handler.java:102)
20  android.os.Looper.loop(Looper.java:211)
21  android.app.ActivityThread.main(ActivityThread.java:5389)
22  java.lang.reflect.Method.invoke(Method.java:-2)
23  java.lang.reflect.Method.invoke(Method.java:372)
24  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
25  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

the same with OnAttachedToWindow:

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.OnAttachedToWindow () [0x0000c] in <7999cc4bd5664eca8a72469344172ca3>:0
  at Android.Views.View.n_OnAttachedToWindow (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <263adecfa58f4c449f1ff56156d886fd>:0
  at (wrapper dynamic-method) System.Object.221c1d62-06f8-470b-a7eb-402aac97e1ec(intptr,intptr)

Thread 1:
0   dalvik.system.VMStack.getThreadStackTrace(VMStack.java:-2)
1   java.lang.Thread.getStackTrace(Thread.java:580)
2   java.lang.Thread.getAllStackTraces(Thread.java:522)
3   com.microsoft.appcenter.crashes.Crashes.saveUncaughtException(Crashes.java:923)
4   com.microsoft.appcenter.crashes.WrapperSdkExceptionManager.saveWrapperException(WrapperSdkExceptionManager.java:50)
5   md58432a647068b097f9637064b8985a5e0.MasterDetailPageRenderer.n_onAttachedToWindow(MasterDetailPageRenderer.java:-2)
6   md58432a647068b097f9637064b8985a5e0.MasterDetailPageRenderer.onAttachedToWindow(MasterDetailPageRenderer.java:52)
7   android.view.View.dispatchAttachedToWindow(View.java:14622)
8   android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2842)
9   android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
10  android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
11  android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
12  android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
13  android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
14  android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
15  android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2849)
16  android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1461)
17  android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1198)
18  android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6268)
19  android.view.Choreographer$CallbackRecord.run(Choreographer.java:873)
20  android.view.Choreographer.doCallbacks(Choreographer.java:676)
21  android.view.Choreographer.doFrame(Choreographer.java:606)
22  android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:859)
23  android.os.Handler.handleCallback(Handler.java:739)
24  android.os.Handler.dispatchMessage(Handler.java:95)
25  android.os.Looper.loop(Looper.java:168)
26  android.app.ActivityThread.main(ActivityThread.java:5885)
27  java.lang.reflect.Method.invoke(Method.java:-2)
28  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
29  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
PureWeen commented 6 years ago

@pauloortins can you try the latest nightly build see if you're having the same issue

https://blog.xamarin.com/try-the-latest-in-xamarin-forms-with-nightly-builds/

Also what Jason says still would be helpful

Do you have any more info about the state change thats happening here? A fragment is being destroyed and knowing what is going on in the app is going to be essential to figuring out whats going on. Java.Lang.Error tells us basically nothing. AppCenter has no other info?

It's hard for us to locate without knowing how you are using the scrollviewrenderer

pauloortins commented 6 years ago

This is the only info that app center give to me.

But I guess that it's in the following flow:

  1. Home Page
  2. Open a Detail Page
  3. Open a page with a ListView
  4. Open another page with a ListView
  5. Pop to 4
  6. Pop to 1 using Navigation.RemovePage and then PopAsync.

Locally I can reproduce in Debug mode but not in Release mode.

PureWeen commented 6 years ago

@pauloortins which page has the scrollview?

And can you paste the XAML for that page?

tbaggett commented 6 years ago

I see a slightly different path leading to this issue, but it ends up with the same error location. Providing info in case it helps. XF 2.5.1.527436 used in this case. Currently testing next release that uses 3.1.0.697729. This issue occurs primarily on API 26 (71.4%), but is also seen on API 24 and 25 (14.3% each).

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown. java.lang.Error: Java callstack: md58432a647068b097f9637064b8985a5e0.FragmentContainer.n_onDestroyView(Native Method) md58432a647068b097f9637064b8985a5e0.FragmentContainer.onDestroyView(FragmentContainer.java:41) android.support.v4.app.Fragment.performDestroyView(Fragment.java:2497) android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1503) android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750) android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819) android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3227) android.support.v4.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3218) android.support.v4.app.FragmentController.dispatchDestroy(FragmentController.java:262) android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:362) android.support.v7.app.AppCompatActivity.onDestroy(AppCompatActivity.java:209) md51558244f76c53b6aeda52c8a337f2c37.FormsAppCompatActivity.n_onDestroy(Native Method) md51558244f76c53b6aeda52c8a337f2c37.FormsAppCompatActivity.onDestroy(FormsAppCompatActivity.java:80) android.app.Activity.performDestroy(Activity.java:7195) android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1161) android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4573) android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4609) android.app.ActivityThread.-wrap7(ActivityThread.java) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:154) android.app.ActivityThread.main(ActivityThread.java:6682) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

mfeingol commented 6 years ago

I'm seeing a very similar issue here with a Xamarin Forms app on Android. Using latest shipped Xamarin Forms (3.1.0.697729).

It's difficult to reproduce, but I can confirm I sometimes see it on Android 8.0 when navigating using the hamburger menu. The latest one I observed involved navigation from a tabbed page to a non-tabbed page.

@PureWeen: are you interested in the XAML for the previous page or the new page?

Here's the crash report from App Center:

Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
1 Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
2 java.lang.Error: Java callstack:
3 md51558244f76c53b6aeda52c8a337f2c37.ScrollViewRenderer.n_onDetachedFromWindow(Native Method)
4 md51558244f76c53b6aeda52c8a337f2c37.ScrollViewRenderer.onDetachedFromWindow(ScrollViewRenderer.java:83)
5 android.view.View.dispatchDetachedFromWindow(View.java:17498)
6 android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3753)
7 android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:5505)
8 android.view.ViewGroup.removeAllViews(ViewGroup.java:5451)
9 mono.java.lang.RunnableImplementor.n_run(Native Method)
10 mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
11 android.os.Handler.handleCallback(Handler.java:789)
12 android.os.Handler.dispatchMessage(Handler.java:98)
13 android.os.Looper.loop(Looper.java:164)
14 android.app.ActivityThread.main(ActivityThread.java:6703)
15 java.lang.reflect.Method.invoke(Native Method)
16 com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
17 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
PureWeen commented 6 years ago

@mfeingol the Xaml would be useful or a short video even just to get an idea of your structures I'm curious about where in the hierarchy your ScrollView lives and how the parent page is being swapped out

The problem I've seen can manifest in a lot of ways depending on how logically someone is swapping out pages. Like during what stage in the lifecycle etc....

If you could repro that would be helpful or if you have something you can email me shneuvil at microsoft that would be kept private that'd be useful

PureWeen commented 6 years ago

@mfeingol thank you for the project. I'll see if I can get it to reproduce the issue and then update the issue here with what I can find out

PureWeen commented 6 years ago

@mfeingol I'm unfortunately still not having much luck recreating the issue

I've clicked around a bunch in the emulators and haven't been able to get the above exception. Can you update to the latest forms 3.2 and then if you're able to get a semi-consistent way to recreate that would be useful. It'd be also useful to know the device you are using and what API

mfeingol commented 6 years ago

Thanks for the repro attempts, @PureWeen. This isn't something I'm seeing myself on a regular basis either, so I don't have any further insight on how best to repro.

I will note I do get the occasional crash report for this. E.g., the two most recent instances in AppCenter are:

Xperia\xe2\x84\xa2 E4 -- Android 4.4.4 -- 4 weeks ago
LG Stylo3 -- Android 7.0 -- 1 week ago
brittonbeckham commented 6 years ago

Wanted to also report my experience with this crash. We recently updated our app to use XF 3.2 and we are experiencing this error on:

Galaxy S7 Edge Android 8.0.0 (R16NW)

Stack Trace looks similar to some of the above. This appears to be happening in the following scenarios:

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
java.lang.Error: Java callstack:
md5f92e0daf340890c9667469657ee2ece8.ImageRenderer.n_invalidate(Native Method)
md5f92e0daf340890c9667469657ee2ece8.ImageRenderer.invalidate(ImageRenderer.java:46)
android.widget.ImageView.invalidateDrawable(ImageView.java:281)
android.graphics.drawable.Drawable.invalidateSelf(Drawable.java:454)
android.graphics.drawable.Drawable.setVisible(Drawable.java:863)
android.widget.ImageView.onDetachedFromWindow(ImageView.java:1629)
android.view.View.dispatchDetachedFromWindow(View.java:18676)
android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:5640)
android.view.ViewGroup.removeAllViews(ViewGroup.java:5586)
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
android.os.Handler.handleCallback(Handler.java:789)
android.os.Handler.dispatchMessage(Handler.java:98)
android.os.Looper.loop(Looper.java:164)
android.app.ActivityThread.main(ActivityThread.java:6944)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType)

TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType)
Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type)
Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
View.n_Invalidate (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) System.Object.43(intptr,intptr)
public static class AppPages
{
    private static Page _root;
    private static NavigationPage _inventory;
    private static NavigationPage _lists;
    private static NavigationPage _home;
    private static NavigationPage _cart;
    private static NavigationPage _community;
    private static Login _login;
    private static NavigationPage _cardView;

    public static Page AppRoot => _root ?? (_root = GetAppRoot());

    private static Page GetAppRoot()
    {
#if DEBUG
        return App.DevBootUpPage.Value ?? new Root();
#else
        return new Root();
#endif
    }

    public static Login Login => _login ?? (_login = new Login());

    public static NavigationPage Home => _home ?? (_home = GetNavPage(new Home()));

    public static NavigationPage Cart => _cart ?? (_cart = GetNavPage(new Cart()));

    public static NavigationPage Inventory => _inventory ?? (_inventory = GetNavPage(new Storage()));

    public static NavigationPage Lists => _lists ?? (_lists = GetNavPage(new Lists()));

    public static NavigationPage Community => _community ?? (_community = GetNavPage(new CommunityBrowser()));

    public static NavigationPage CardView => _cardView ?? (_cardView = GetNavPage(new CardView()));

    private static NavigationPage GetNavPage(Page page)
    {
        return new NavigationPage(page)
        {
            Icon = page.Icon,
            Title = page.Title,         
            BarBackgroundColor = (Color)App.Current.Resources["PrepifyOrange"],
            BarTextColor = Color.White,
        };
    }

    public static void Reset()
    {
        _root = null;
        _home = null;
        _inventory = null;
        _lists = null;
        _community = null;
        _cart = null;
    }
}

Forgot to mention that we are only seeing this on the aforementioned phone so far (with very limited testing), but not on my own personal Pixel 2.

samhouts commented 5 years ago

We made some changes to the order that we dispose renderers in 3.3. Are you able to update and see if it helps reduce the incidence of this crash? Thanks!

mfeingol commented 5 years ago

I haven't seen a reported instance of this since releasing a version of the app with XF 3.3. But time will tell.

OlegKlym commented 5 years ago

I have this crash in 3.3 and 3.4 XF when I turned off an app to tray and resumed it Java.Interop.JavaLocationException -Unable to activate instance of type Droid.Renderers.PageRenderer from native handle

modplug commented 5 years ago

This is our stack trace for the same bug. We are running on 3.1 since we're stuck waiting for another bug to be fixed in XF iOS before we can upgrade. I just wanted to paste the stack trace here in case it helps with the investigation. It happens after the app has been minimized to the app tray, and then loaded again

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
java.lang.Error: Java callstack:
md58432a647068b097f9637064b8985a5e0.TabbedPageRenderer.n_onDetachedFromWindow(Native Method)
md58432a647068b097f9637064b8985a5e0.TabbedPageRenderer.onDetachedFromWindow(TabbedPageRenderer.java:65)
android.view.View.dispatchDetachedFromWindow(View.java:18400)
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3777)
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3769)
android.view.ViewGroup.removeViewInternal(ViewGroup.java:5359)
android.view.ViewGroup.removeViewInternal(ViewGroup.java:5330)
android.view.ViewGroup.removeView(ViewGroup.java:5261)
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1520)
android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:792)
android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590)
android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377)
android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332)
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239)
android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:781)
md58e504abd1d5ffe8f84a4c4b5a219404c.MainActivity.n_onCreate(Native Method)
md58e504abd1d5ffe8f84a4c4b5a219404c.MainActivity.onCreate(MainActivity.java:32)
android.app.Activity.performCreate(Activity.java:7144)
android.app.Activity.performCreate(Activity.java:7135)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2894)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3049)
android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loop(Looper.java:193)
android.app.ActivityThread.main(ActivityThread.java:6680)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
PureWeen commented 5 years ago

@modplug

We are running on 3.1 since we're stuck waiting for another bug to be fixed in XF iOS before we can upgrade.

What bug?

And can you provide a repro or send me your app privately? shneuvil at microsoft.com

modplug commented 5 years ago

The bug I was referring to is: NavigationPage.TitleIcon no longer centered. Although it is marked as fixed I can't find it included in a Xamarin Forms version.

Unfortunately I can't provide a repro since it's a commercial app :/

samhouts commented 5 years ago

@modplug #4138 should be fixed in 3.4.0, FYI.

samhouts commented 5 years ago

@OlegKlym Are you using a custom page renderer?

modplug commented 5 years ago

@samhouts As far as I can see there hasn't been a relase of 3.4.0 since the fix was included

PureWeen commented 5 years ago

It'll be part of the SR for 3.4.0

modplug commented 5 years ago

Ok thanks @PureWeen . Any ETA for the SR?

StephaneDelcroix commented 5 years ago

@PureWeen so can we close this ?

PureWeen commented 5 years ago

No @StephaneDelcroix the conversation with @modplug was about something holding him back from upgrading to 3.4 to test if 3.4 fixes this bug for them

samhouts commented 5 years ago

Since we haven't heard from you in more than 30 days, we hope this issue is no longer affecting you. If it is, please reopen this issue and provide the requested information so that we can look into it further. Thank you!

georgethms10 commented 5 years ago

@samhouts Is this issue actually solved, i am using xf 3.2 and i am getting this error frequently in my map renderer. Any fix for this issue

Transis-Felipe commented 5 years ago

Same error for me too.

XF 4.1

StinkyTowel commented 4 years ago

Just released a new version of our app with XF 4.1.0.709244 and seeing this as well. So far only on Galaxy J7 Pop running Android 8.1.

Also seeing a crash report on md51558244f76c53b6aeda52c8a337f2c37.ScrollViewRenderer.draw. We'll continue to monitor before creating an issue.

GalaxiaGuy commented 4 years ago

On the off chance this is useful to anyone, I get the following stack trace:

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
java.lang.Error: Java callstack:
md51558244f76c53b6aeda52c8a337f2c37.FormsTextView.n_invalidate(Native Method)
md51558244f76c53b6aeda52c8a337f2c37.FormsTextView.invalidate FormsTextView.java:45
android.view.ViewRootImpl$InvalidateOnAnimationRunnable.run ViewRootImpl.java:7905
android.view.Choreographer$CallbackRecord.run Choreographer.java:967
android.view.Choreographer.doCallbacks Choreographer.java:791
android.view.Choreographer.doFrame Choreographer.java:722
android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:952
android.os.Handler.handleCallback Handler.java:883
android.os.Handler.dispatchMessage Handler.java:100
android.os.Looper.loop Looper.java:214
android.app.ActivityThread.main ActivityThread.java:7356
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:492
com.android.internal.os.ZygoteInit.main ZygoteInit.java:930
EmilAlipiev commented 4 years ago

XF 4.4 version and problem still exists. It can be reproduced mostly during the screen orientation change.

thisisthekap commented 4 years ago

@samhouts As Xamarin.Forms 4.4 is affected according to @EmilAlipiev (what we can confirm on our side due to app center crash reports), this issue should be reopened.

samhouts commented 4 years ago

@EmilAlipiev @thisisthekap I can reopen this issue, but without a reproduction project, we have no way to know how to resolve the issue or how to verify if/when we have fixed it. Can you please supply a reproduction? Thanks!

PureWeen commented 4 years ago

@EmilAlipiev @thisisthekap can you post your exact stack traces?

This issue has like 5 different stack traces that are all probably related to different things

thisisthekap commented 4 years ago

@PureWeen Happy to help:

Device: Samsung Galaxy S8 OS: Android 9

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown. java.lang.Error: Java callstack: md5<packagemd5>.ScrollViewRenderer.n_onDetachedFromWindow(Native Method) md5<packagemd5>.ScrollViewRenderer.onDetachedFromWindow ScrollViewRenderer.java:83 android.view.View.dispatchDetachedFromWindow View.java:20067 android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3995 android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3987 android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3987 android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3987 android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3987 android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3987 android.view.ViewRootImpl.dispatchDetachedFromWindow ViewRootImpl.java:4494 android.view.ViewRootImpl.doDie ViewRootImpl.java:7979 android.view.ViewRootImpl.die ViewRootImpl.java:7947 android.view.WindowManagerGlobal.removeViewLocked WindowManagerGlobal.java:497 android.view.WindowManagerGlobal.removeView WindowManagerGlobal.java:435 android.view.WindowManagerImpl.removeViewImmediate WindowManagerImpl.java:124 android.app.ActivityThread.handleDestroyActivity ActivityThread.java:4753 android.app.servertransaction.DestroyActivityItem.execute DestroyActivityItem.java:39 android.app.servertransaction.TransactionExecutor.executeLifecycleState TransactionExecutor.java:145 android.app.servertransaction.TransactionExecutor.execute TransactionExecutor.java:70 android.app.ActivityThread$H.handleMessage ActivityThread.java:1948 android.os.Handler.dispatchMessage Handler.java:106 android.os.Looper.loop Looper.java:214 android.app.ActivityThread.main ActivityThread.java:7050 java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:493 com.android.internal.os.ZygoteInit.main ZygoteInit.java:965

MitchBomcanhao commented 4 years ago

I'm seeing this stack on our app, when it is redrawing some content on the page. don't know what it is doing yet, but have seen this crash twice today on my testing, and have seen the occasional crash from end users. All the affected users were on android 9. XF 4.2.0.910310

App freezes and gets terminated after some time.

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
    java.lang.Error: Java callstack:
    crc643f46942d9dd1fff9.FormsTextView.n_invalidate(Native Method)
    crc643f46942d9dd1fff9.FormsTextView.invalidate FormsTextView.java:45
    android.view.ViewRootImpl$InvalidateOnAnimationRunnable.run ViewRootImpl.java:7404
    android.view.Choreographer$CallbackRecord.run Choreographer.java:949
    android.view.Choreographer.doCallbacks Choreographer.java:761
    android.view.Choreographer.doFrame Choreographer.java:693
    android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:935
    android.os.Handler.handleCallback Handler.java:873
    android.os.Handler.dispatchMessage Handler.java:99
    android.os.Looper.loop Looper.java:193
    android.app.ActivityThread.main ActivityThread.java:6923
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:493
    com.android.internal.os.ZygoteInit.main ZygoteInit.java:870
MitchBomcanhao commented 4 years ago

when debugging, this exception is raised

Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer from native handle 0xbef9418c (key_handle 0x14861bd).
  at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00182] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000c1] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Android.Views.View.n_Invalidate (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.51(intptr,intptr)

with this additional info

{System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer from native handle 0xbef9418c (key_handle 0x14861bd). 
---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
   --- End of inner exception stack trace ---
  at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00055] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00116] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
   --- End of inner exception stack trace ---
  at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00182] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000c1] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at Android.Views.View.n_Invalidate (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <4ccdb3137d974856b786e1aeebbfbab6>:0 
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.51(intptr,intptr)}
MitchBomcanhao commented 4 years ago

Using a custom LabelRenderer like this

    public class CustomLabelRenderer : LabelRenderer
    {
        public CustomLabelRenderer (Android.Content.Context context) : base(context)
        {
        }
    }

it appears to stop the crashes

thisisthekap commented 4 years ago

@MitchBomcanhao I am not sure, if your bug is related to the one originally posted in this issue. The stack traces seem to be quite different. Do you have any insights on why these issues are connected or even the same?

mduchev commented 3 years ago

I can confirm that the issue is still present. Just happened on an user with Android 11 and POCO F2 Pro. Xamarin Forms: 4.8.0.1821 Stack trace(s):

Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown. java.lang.Error: Java callstack: crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_onTouchEvent(Native Method) crc643f46942d9dd1fff9.Platform_DefaultRenderer.onTouchEvent(Unknown Source:0) android.view.View.dispatchTouchEvent View.java:14366 android.view.ViewGroup.dispatchTransformedTouchEvent ViewGroup.java:3153 android.view.ViewGroup.dispatchTouchEvent ViewGroup.java:2819 crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_dispatchTouchEvent(Native Method) crc643f46942d9dd1fff9.Platform_DefaultRenderer.dispatchTouchEvent(Unknown Source:0) android.view.ViewGroup.dispatchTransformedTouchEvent ViewGroup.java:3140 android.view.ViewGroup.dispatchTouchEvent ViewGroup.java:2819 crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_dispatchTouchEvent(Native Method) crc643f46942d9dd1fff9.Platform_DefaultRenderer.dispatchTouchEvent(Unknown Source:0) android.view.ViewGroup.dispatchTransformedTouchEvent ViewGroup.java:3140 android.view.ViewGroup.dispatchTouchEvent ViewGroup.java:2819 android.view.ViewGroup.dispatchTransformedTouchEvent ViewGroup.java:3140 android.view.ViewGroup.dispatchTouchEvent ViewGroup.java:2819 android.view.ViewGroup.dispatchTransformedTouchEvent ViewGroup.java:3140 android.view.ViewGroup.dispatchTouchEvent ViewGroup.java:2819 android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent PopupWindow.java:2580 android.view.View.dispatchPointerEvent View.java:14627 android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent ViewRootImpl.java:6164 android.view.ViewRootImpl$ViewPostImeInputStage.onProcess ViewRootImpl.java:5964 android.view.ViewRootImpl$InputStage.deliver ViewRootImpl.java:5453 android.view.ViewRootImpl$InputStage.onDeliverToNext ViewRootImpl.java:5510 android.view.ViewRootImpl$InputStage.forward ViewRootImpl.java:5476 android.view.ViewRootImpl$AsyncInputStage.forward ViewRootImpl.java:5628 android.view.ViewRootImpl$InputStage.apply ViewRootImpl.java:5484 android.view.ViewRootImpl$AsyncInputStage.apply ViewRootImpl.java:5685 android.view.ViewRootImpl$InputStage.deliver ViewRootImpl.java:5457 android.view.ViewRootImpl$InputStage.onDeliverToNext ViewRootImpl.java:5510 android.view.ViewRootImpl$InputStage.forward ViewRootImpl.java:5476 android.view.ViewRootImpl$InputStage.apply ViewRootImpl.java:5484 android.view.ViewRootImpl$InputStage.deliver ViewRootImpl.java:5457 android.view.ViewRootImpl.deliverInputEvent ViewRootImpl.java:8260 android.view.ViewRootImpl.doProcessInputEvents ViewRootImpl.java:8211 android.view.ViewRootImpl.enqueueInputEvent ViewRootImpl.java:8171 android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent ViewRootImpl.java:8388 android.view.InputEventReceiver.dispatchInputEvent InputEventReceiver.java:283 android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next MessageQueue.java:335 android.os.Looper.loop Looper.java:193 android.app.ActivityThread.main ActivityThread.java:7876 java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:656 com.android.internal.os.ZygoteInit.main ZygoteInit.java:967

TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType)

Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) View.n_OnTouchEvent_Landroid_viewMotionEvent (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.59(intptr,intptr,intptr)

eduardoqc183 commented 3 years ago

Problem still exists: Samsung Galaxy A12 Android 11 (SDK 30)

Xamarin Forms: 5.0.0.2125

Stack trace(s): java.lang.RuntimeException: at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5607) at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5652) at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:5955) at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5874) at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:69) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95) at android.app.ClientTransactionHandler.executeTransaction (ClientTransactionHandler.java:63) at android.app.ActivityThread.handleRelaunchActivityLocally (ActivityThread.java:5938) at android.app.ActivityThread.access$3400 (ActivityThread.java:301) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2317) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:246) at android.app.ActivityThread.main (ActivityThread.java:8528) 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) Caused by: java.lang.IllegalArgumentException: at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:513) at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:282) at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:2002) at androidx.fragment.app.FragmentManager.executePendingTransactions (FragmentManager.java:600) at crc643f46942d9dd1fff9.FormsAppCompatActivity.n_onDestroy (Native Method) at crc643f46942d9dd1fff9.FormsAppCompatActivity.onDestroy (FormsAppCompatActivity.java:88) at android.app.Activity.performDestroy (Activity.java:8468) at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1344) at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5592)