Android TabbedPage Appcompat-v7 - Unable to find resource ID #0x1

JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭

Anybody else getting the same exception when rotating an Android Device using the new Appcompat library?
Im getting an Android.Content.Res.Resources.+NotFoundException with description: Unable to find resource ID #0x1
It indicates that im missing some kind of resource reference, but I have double-checked that the navigationpages Icons are present in the Resources folder..

Application Output:
[GraphicBuffer] unregister, handle(0x845679e8) (w:540 h:888 s:544 f:0x1 u:0x000900)
[GraphicBuffer] unregister, handle(0x84da2310) (w:540 h:888 s:544 f:0x1 u:0x000900)
[GraphicBuffer] unregister, handle(0x84c4b630) (w:540 h:888 s:544 f:0x1 u:0x000900)
[GraphicBuffer] unregister, handle(0x8506eb80) (w:540 h:888 s:544 f:0x1 u:0x000900)
[ResourceType] No package identifier when getting name for resource number 0x00000001

This exception is only thrown when rotating the device, it runs just fine in portrait mode..

Thanks in advance.

Answers

  • Getting a similar exception, but I don't know when it occurs. It's just logged in Xamarin.Insights:

    Java.Lang.RuntimeExceptionUnable to find resource ID #0x1
    Raw
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <filename unknown>:0 
      at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod) [0x00089] in <filename unknown>:0 
      at Android.App.Activity.OnStart () [0x00079] in <filename unknown>:0 
      at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnStart () [0x00000] in <filename unknown>:0 
      at Android.App.Activity.n_OnStart (IntPtr jnienv, IntPtr native__this) [0x00009] in <filename unknown>:0 
      at (wrapper dynamic-method) System.Object:7d0e331b-d4f1-4cbb-a8a3-724a7cd54953 (intptr,intptr)
      --- End of managed exception stack trace ---
    android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1
        at android.content.res.Resources.getResourceName(Resources.java:2119)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1018)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1189)
        at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2001)
        at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:165)
        at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:507)
        at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.n_onStart(Native Method)
        at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.onStart(FormsAppCompatActivity.java:102)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
        at android.app.Activity.performStart(Activity.java:6006)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2342)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2442)
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4053)
        at android.app.ActivityThread.access$900(ActivityThread.java:156)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1357)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:211)
        at android.app.ActivityThread.main(ActivityThread.java:5373)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
    
  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭

    Great to know im not the only one seeing this.

    Contacting support.. Will post when i hear back.

  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭

    @BastiBrauning Did you ever manage to resolve this or find the root of the cause?
    There has been created a Bugzilla now: https://bugzilla.xamarin.com/show_bug.cgi?id=36448
    If you have anything to add the bugzilla, please dont hesitate.

  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭
    edited December 2015

    @BastiBrauning . Found my issue.

    In my MainActivity file i had implemented the Appcompat v7 using James Montgomery guide, but had somehow missed this part:
    Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, WindowSoftInputMode = SoftInput.AdjustResize)]

    adding the ConfigurationChanges fixed all my crash issues.
    Hope it might help you too.

  • Thanks for reporting back!

    I still have the issue "Java.Lang.RuntimeExceptionUnable to find resource ID #0x1" one some devices.

    Despite already having the Attributes on my MainActivity.

  • ddotmunchddotmunch DEMember ✭✭

    Any news on this one? We're getting the same exception on some devcies, despite having ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation on our MainActivity.

  • Same issue appearing in my project with XF 2.0.0.6490.

  • akamudakamud BRUniversity ✭✭

    Still having this issue even with the attribute present.

  • AntonyRey.9710AntonyRey.9710 FRMember ✭✭
    edited October 2016

    Hi,

    Same issue here sometimes when switching Application.MainPage property (using Xamarin.Forms 2.3.2)

    Thanks,

    Antony

  • batmacibatmaci DEMember ✭✭✭✭✭

    I still cant make it working. Anybody found any solution please?

  • batmacibatmaci DEMember ✭✭✭✭✭

    This is super annoying!!!!!!!!!!!!! I spent almost good half a day and finally found my problem. If you are having some asynchronous operation. make sure that you do this correct. example is in this post. You will get exact error message if you run your xamarin.forms application in UWP. UWP will tell you something is wrong with your threads.

  • MarketAllyMarketAlly USMember ✭✭

    I have been getting this issue and have submitted a bug with a clear example that doesn't have async calls in it. It is in Android.Support.v4 23.3.0 - prior to it and it works fine.

    https://bugzilla.xamarin.com/show_bug.cgi?id=52314

  • Malcolm.JackMalcolm.Jack ZAMember ✭✭
    edited March 2017

    @AntonyRey.9710 - you find the issue?

    I'm also seeing this when switching out the Application.Current.MainPage property.

    EDIT: It seems the cause in my case was calling Navigation.PopToRootAsync() before resetting MainPage - when in fact the NavigationStack was empty.

    Just adding a check on Navigation.NavigationStack.Count > 0 before calling PopToRootAsync() seems to avoid the error.

  • bdlbdl DKMember ✭✭

    @Malcolm.Jack I am experiencing the same issue. I am getting crashes when I set the MainPage to an instnace of TabbedPage.

    Did you manage to find a way around this?

  • MalcolmJackMalcolmJack USMember ✭✭

    @bdl .. already posted what was causing my issue. Unfortunately Resource error could mean a bunch of things.
    Could be that there's an issue with the xaml on the tabbed page - without a repro, unfortunately it's all conjecture.
    I've also encountered this error when multiple threads were setting the MainPage in quick succession due to multiple events firing.

Sign In or Register to comment.