Hi,
in my App (v1.0), after startup (PageMainList_Appearing), I restore the last loaded item, so user can continue where he stopped. It means, it opens a TabbedPage ('PageItemTab') from the startup ContentPage ('PageMainList').
private async void PageMainList_Appearing(object sender, EventArgs e)
{
if (_firstAppearing)
{
_firstAppearing = false;
await LoadLastItem();
}
}
private async Task LoadLastItem()
{
if (_lastItem != null)
await Navigation.PushAsync(new PageItemTab(new PageItemTabViewModel(_lastItem, _viewModel)), false);
}
It works fine, when user stats the App, it will automatically go to 'PageItemTab', instead of staying on the 'PageMainList' if _'lastItem' present.
Recently I updated my App (v2.0), added several new xamls, pages, views, etc
After updating the App (so not a new install, but updating the v1.0 from google store to v2.0), it's crashing during startup.
01-05 08:48:30.508: I/MonoDroid(14377): UNHANDLED EXCEPTION:
01-05 08:48:30.526: I/MonoDroid(14377): Java.Lang.RuntimeException: Binary XML file line #18: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true ---> Java.Lang.RuntimeException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true
01-05 08:48:30.526: I/MonoDroid(14377): --- End of inner exception stack trace ---
01-05 08:48:30.526: I/MonoDroid(14377): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0xc6db69b0 + 0x0001c> in <cb95916d2ab2444a9f5f028c397d3ddc>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <987c74f57d34446381aca87f1f37f5f4>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) <0xc6ac3b20 + 0x0006b> in <7c90ee8f863548b3b1b2c6032f12ed13>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Android.Support.Design.Widget.TabLayout.SetupWithViewPager (Android.Support.V4.View.ViewPager viewPager) <0xc5cf3bd8 + 0x001d7> in <12ef52c9fdb344f58cbdf75db3fa86d8>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer.OnChildrenCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) <0xc64d5558 + 0x00217> in <7fcbd59ddd2f4ebfb60e22f10868ab72>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) <0xc64d4a7c + 0x00383> in <7fcbd59ddd2f4ebfb60e22f10868ab72>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) <0xc64bc114 + 0x00207> in <7fcbd59ddd2f4ebfb60e22f10868ab72>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) <0xc64bbcc4 + 0x0005b> in <7fcbd59ddd2f4ebfb60e22f10868ab72>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) <0xc649cdc4 + 0x0015f> in <7fcbd59ddd2f4ebfb60e22f10868ab72>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) <0xc64c9d98 + 0x0003b> in <7fcbd59ddd2f4ebfb60e22f10868ab72>:0
01-05 08:48:30.526: I/MonoDroid(14377): at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) <0xc5f47090 + 0x000bf> in <27c17fe440cf491ba8255bcefade6e02>:0
01-05 08:48:30.526: I/MonoDroid(14377): at (wrapper dynamic-method) System.Object:c29447c3-0562-4939-813f-8da619914dcf (intptr,intptr,intptr,intptr,intptr)
01-05 08:48:30.526: I/MonoDroid(14377): --- End of managed Java.Lang.RuntimeException stack trace ---
01-05 08:48:30.526: I/MonoDroid(14377): android.view.InflateException: Binary XML file line #18: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true
01-05 08:48:30.526: I/MonoDroid(14377): Caused by: android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true
01-05 08:48:30.526: I/MonoDroid(14377): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-05 08:48:30.526: I/MonoDroid(14377): at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout$TabView.update(TabLayout.java:1531)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout$TabView.setTab(TabLayout.java:1484)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout$TabView.access$700(TabLayout.java:1348)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout.createTabView(TabLayout.java:799)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout.newTab(TabLayout.java:500)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout.populateFromPagerAdapter(TabLayout.java:773)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout.setPagerAdapter(TabLayout.java:764)
01-05 08:48:30.526: I/MonoDroid(14377): at android.support.design.widget.TabLayout.setupWithViewPager(TabLayout.java:716)
01-05 08:48:30.527: I/MonoDroid(14377): at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onCreateView(Native Method)
01-05 08:48:30.527: I/MonoDroid(14377): at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onCreateView(FragmentContainer.java:51)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:495)
01-05 08:48:30.527: I/MonoDroid(14377): at android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:168)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.Activity.performResume(Activity.java:7125)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3821)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3885)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.ActivityThread.-wrap14(ActivityThread.java)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
01-05 08:48:30.527: I/MonoDroid(14377): at android.os.Handler.dispatchMessage(Handler.java:102)
01-05 08:48:30.527: I/MonoDroid(14377): at android.os.Looper.loop(Looper.java:154)
01-05 08:48:30.527: I/MonoDroid(14377): at android.app.ActivityThread.main(ActivityThread.java:6776)
01-05 08:48:30.527: I/MonoDroid(14377): at java.lang.reflect.Method.invoke(Native Method)
01-05 08:48:30.527: I/MonoDroid(14377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
01-05 08:48:30.527: I/MonoDroid(14377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
If I do an uninstall/re-install, it's ok.
If I upgrade v1.0 -> v2.0, crash.
If I don't call 'LoadLastItem', it works fine.
So I can only guess, something is messed up with some v1.0 locally cached xaml binary(is there such thing at all?), and after upgrade to v2.0, it tries to use the v1.0 cached view pages, but it's not matching anymore, as new views are introduced in v2.0.
And if I do an un/re-install, it will also remove all cached view data, etc, so it works fine.
But what can I do with it? Users will not uninstall/re-install, they will upgrade (obviously).
Do you have any idea what is going on, and what can I do?