Forum Xamarin.Forms

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

JTOneJTOne USMember ✭✭

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

Best Answer

Answers

  • JTOneJTOne USMember ✭✭
    Accepted Answer
  • EZHartEZHart USXamarin Team Xamurai

    @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.

  • abecabec USMember

    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

  • SchinwinkwinskySchinwinkwinsky BRMember ✭✭

    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.

  • oguzhanorhaanoguzhanorhaan TRMember ✭✭

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

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @oguzhanorhaan have you found a fix for this?

  • oguzhanorhaanoguzhanorhaan TRMember ✭✭

    @15mgm15 unfortunately

  • 15mgm1515mgm15 USMember ✭✭✭✭

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

  • MikilllMikilll Member ✭✭✭

    @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.

Sign In or Register to comment.