locked
Issue with Forms 2.4.0.280 on an android [No view found for id 0x1 (unknown) for fragment] RRS feed

  • Question

  • User141776 posted

    Hello,

    After an update of xamarin.forms nuget to 2.4.0.280, I have an issue with an android

    Here's stack trace:

    09-29 06:50:25.610 E/mono (17500): Unhandled Exception: 09-29 06:50:25.610 E/mono (17500): Java.Lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment FragmentContainer{1716c46c #0 id=0x1} referenceTable GDEF length=670 1 referenceTable GSUB length=7202 1 referenceTable GPOS length=24560 1 09-29 06:50:25.610 E/mono (17500): --- End of managed Java.Lang.IllegalArgumentException stack trace --- 09-29 06:50:25.610 E/mono (17500): java.lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment FragmentContainer{1716c46c #0 id=0x1} 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1334) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1569) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:379) 09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607) 09-29 06:50:25.610 E/mono (17500): at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) 09-29 06:50:25.610 E/mono (17500): at md5a32ee3795e82798420962242b26c9524.MvxFormsAppCompatActivity.n_onStart(Native Method) 09-29 06:50:25.610 E/mono (17500): at md5a32ee3795e82798420962242b26c9524.MvxFormsAppCompatActivity.onStart(MvxFormsAppCompatActivity.java:43) 09-29 06:50:25.610 E/mono (17500): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220) 09-29 06:50:25.610 E/mono (17500): at android.app.Activity.performStart(Activity.java:5953) 09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261) 09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.access$800(ActivityThread.java:144) 09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 09-29 06:50:25.610 E/mono (17500): at android.os.Handler.dispatchMessage(Handler.java:102) 09-29 06:50:25.610 E/mono (17500): at android.os.Looper.loop(Looper.java:135) 09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.main(ActivityThread.java:5221) 09-29 06:50:25.610 E/mono (17500): at java.lang.reflect.Method.invoke(Native Method) 09-29 06:50:25.610 E/mono (17500): at java.lang.reflect.Method.invoke(Method.java:372) 09-29 06:50:25.610 E/mono (17500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 09-29 06:50:25.610 E/mono (17500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 09-29 06:50:25.610 E/mono (17500):

    There is an example of the issue https://github.com/JTOne123/XamFormsMvxTemplate/blob/master/MvxForms.sln

    PS: If switch back to 2.3.4, everything will be ok

    Friday, September 29, 2017 1:46 PM

Answers

  • User141776 posted

    The issue is closed

    The issue was the calling of Form.Init twice

    https://github.com/JTOne123/XamFormsMvxTemplate/blob/master/MvxForms/MvxForms.Droid/FormsApplicationActivity.cs

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, October 5, 2017 12:54 PM

All replies

  • User141776 posted

    The issue is closed

    The issue was the calling of Form.Init twice

    https://github.com/JTOne123/XamFormsMvxTemplate/blob/master/MvxForms/MvxForms.Droid/FormsApplicationActivity.cs

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, October 5, 2017 12:54 PM
  • User162453 posted

    @JTOne We had a bug in 2.4.0.280 where calling Forms.Init twice on Android could cause a crash; it was fixed in 2.4.0.282. You might have been running into that issue.

    Monday, October 9, 2017 4:58 PM
  • User344519 posted

    I managed to fix it with few if-else statements. I have an issue with OnParentSet() Where I tried to make my loading screen longer than usual so that I can load the proper page. I got this same error because it called this function twice... So thanks for answer

    Friday, February 16, 2018 10:49 AM
  • User200033 posted

    At my application the exception is thrown when a HttpClient.GetAsync is executed for the second time. At the first time it runs ok. If the bearerToken (line 62) is empty or is not valid, the client.GetAsync method (line 66) will return Unauthorized and the application goes to SignIn Page to user reenter its credentials and to obtain a new bearerToken. Than the method of the image is executed again. But at second time, the exception is thrown by client.GetAsync.

    Tuesday, April 10, 2018 2:06 PM
  • User339762 posted

    I had the same issue after updating to Xamarin.Forms 3.0, I checked but there is no Forms.Init() twice

    Friday, June 1, 2018 5:03 PM
  • User57571 posted

    @oguzhanorhaan have you found a fix for this?

    Tuesday, June 5, 2018 9:33 PM
  • User339762 posted

    @15mgm15 unfortunately

    Tuesday, June 5, 2018 9:34 PM
  • User57571 posted

    Silly me, I was setting the App.MainPage twice. :D

    Tuesday, June 5, 2018 9:48 PM
  • User369433 posted

    @15mgm15 said: Silly me, I was setting the App.MainPage twice. :D

    And what's the problem with that? IMO you can set main page as many times as you want, so this shouldn't cause an exception.

    Wednesday, July 4, 2018 6:38 PM