Bug 52314 - No package identifier when getting name for resource number 0x00000002
Summary: No package identifier when getting name for resource number 0x00000002
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-05 18:51 UTC by Dave Friedel
Modified: 2018-03-20 01:09 UTC (History)
8 users (show)

Tags: BZCU android ac
Is this bug a regression?: ---
Last known good build:


Attachments
working project prior to upgrade (55.30 KB, application/x-zip-compressed)
2017-02-05 19:11 UTC, Dave Friedel
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 52314 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Dave Friedel 2017-02-05 18:51:45 UTC
When I do a Tab  within a Tab, Xamarin Forms would execute this fine with Xamarin.Android.Support.v4 prior to 23.3.0 but once I upgraded, I am getting the following when I flip back to previous tabs:

    Android.Content.Res.Resources+NotFoundException: Unable to find resource ID #0x2
    
    02-05 13:30:38.599 D/Mono    ( 5231): [0x7f7a63f440] worker finishing
    Thread finished: <Thread Pool> #4
    02-05 13:30:39.372 D/Mono    ( 5231): DllImport attempting to load: '/system/lib64/liblog.so'.
    02-05 13:30:39.373 D/Mono    ( 5231): DllImport loaded library '/system/lib64/liblog.so'.
    02-05 13:30:39.373 D/Mono    ( 5231): DllImport searching in: '/system/lib64/liblog.so' ('/system/lib64/liblog.so').
    02-05 13:30:39.373 D/Mono    ( 5231): Searching for '__android_log_print'.
    02-05 13:30:39.373 D/Mono    ( 5231): Probing '__android_log_print'.
    02-05 13:30:39.373 D/Mono    ( 5231): Found as '__android_log_print'.
    02-05 13:30:39.383 I/MonoDroid( 5231): UNHANDLED EXCEPTION:
    02-05 13:30:39.396 I/MonoDroid( 5231): Android.Content.Res.Resources+NotFoundException: Unable to find resource ID #0x2
    02-05 13:30:39.396 I/MonoDroid( 5231):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x000a7] in /Users/builder/data/lanes/3511/501e63ce/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12083 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (System.IntPtr jobject, System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/builder/data/lanes/3511/501e63ce/source/monodroid/src/Mono.Android/JNIEnv.g.cs:444 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at Android.Support.V4.View.ViewPager.SetCurrentItem (System.Int32 item, System.Boolean smoothScroll) [0x000a4] in <27c17fe440cf491ba8255bcefade6e02>:0 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at FormsTabsSample.Droid.CustomTabbedPageRenderer.<OnElementChanged>b__4_0 (System.Object s, Android.Support.Design.Widget.TabLayout+TabSelectedEventArgs a) [0x00001] in C:\Solutions\Xamarin.Samples-master2\Xamarin.Samples-master\Xamarin Forms\FormsTabsSample\Droid\Renderers\CustomTabbedPageRenderer.cs:46 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at Android.Support.Design.Widget.TabLayout+IOnTabSelectedListenerImplementor.OnTabSelected (Android.Support.Design.Widget.TabLayout+Tab tab) [0x0001a] in <12ef52c9fdb344f58cbdf75db3fa86d8>:0 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at Android.Support.Design.Widget.TabLayout+IOnTabSelectedListenerInvoker.n_OnTabSelected_Landroid_support_design_widget_TabLayout_Tab_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_tab) [0x00011] in <12ef52c9fdb344f58cbdf75db3fa86d8>:0 
    02-05 13:30:39.396 I/MonoDroid( 5231):   at (wrapper dynamic-method) System.Object:d871213f-c5f7-4d24-beab-540f990e18c2 (intptr,intptr,intptr)
    02-05 13:30:39.396 I/MonoDroid( 5231):   --- End of managed Android.Content.Res.Resources+NotFoundException stack trace ---
    02-05 13:30:39.396 I/MonoDroid( 5231): android.content.res.Resources$NotFoundException: Unable to find resource ID #0x2
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.content.res.Resources.getResourceName(Resources.java:2327)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1059)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2046)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1989)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1430)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:732)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.view.ViewPager.populate(ViewPager.java:1177)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:608)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:570)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:562)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at mono.android.support.design.widget.TabLayout_OnTabSelectedListenerImplementor.n_onTabSelected(Native Method)
    02-05 13:30:39.396 I/MonoDroid( 5231): 	at mono.android.support.design.widget.TabLayout_OnTabSelectedListenerImplementor.onTabSelected(TabLayout_OnTabSelectedListenerImplementor.java:40)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1025)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.support.design.widget.TabLayout.selectTab(TabLayout.java:995)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.support.design.widget.TabLayout$Tab.select(TabLayout.java:1272)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.support.design.widget.TabLayout$TabView.performClick(TabLayout.java:1377)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.view.View$PerformClick.run(View.java:21315)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.os.Handler.handleCallback(Handler.java:743)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.os.Handler.dispatchMessage(Handler.java:95)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.os.Looper.loop(Looper.java:150)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at android.app.ActivityThread.main(ActivityThread.java:5665)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at java.lang.reflect.Method.invoke(Native Method)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
    02-05 13:30:39.397 I/MonoDroid( 5231): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
    02-05 13:30:39.408 D/Mono    ( 5231): DllImport searching in: '__Internal' ('(null)').
    02-05 13:30:39.408 D/Mono    ( 5231): Searching for 'java_interop_jnienv_throw'.
    02-05 13:30:39.408 D/Mono    ( 5231): Probing 'java_interop_jnienv_throw'.
    02-05 13:30:39.408 D/Mono    ( 5231): Found as 'java_interop_jnienv_throw'.

It appears that 23.3.0 has an issue locating a resource that did not have this issue in 23.0.1.3.  I would just not upgrade but I want the ability for the text to be under the icons in my tab items.  In the attachment, I have put the app in a working state.  If you upgrade to the latest Xamarin.Forms 2.3.3.180 it will then error when you click around on the bottom tabs but it works before you upgrade.

Any assistance would be great appreciated.  If needed, I can provide a sample project.
Comment 1 Dave Friedel 2017-02-05 19:11:56 UTC
Created attachment 19725 [details]
working project prior to upgrade

this provides the working project prior to upgrading to 23.3.0
Comment 2 Dave Friedel 2017-02-07 00:22:16 UTC
My guess is, in the support library, either by design, or has a bug, the fragment manager requires the top level view group to have IDs.  If you can assist in how I can resolve - I will gladly take the necessary steps.

https://stackoverflow.com/questions/15262261/android-content-res-resourcesnotfoundexception-unable-to-find-resource-id-0xf
Comment 3 Ashley Gazich [MSFT] 2017-02-09 16:49:15 UTC
I can replicate the reported behavior using the test case provided in Comment 1. Downgrading to Xamarin.Forms v2.1.0.6521 & Xamarin.Android.Support.v4 23.0.1.3 appears to eliminate the issue.


### Version information

=== Xamarin Studio Enterprise ===

Version 6.2 (build 1809)
Installation UUID: bbb2aa5e-cc9f-46b8-8fd1-94319df9787c
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/ba7f169) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000483

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.1.8
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin Inspector ===

Version: 1.0.0.0
Hash: 1f3067d
Branch: master
Build date: Tue, 15 Nov 2016 21:13:59 GMT

=== Xamarin.Android ===

Version: 7.1.0.34 (Visual Studio Enterprise)
Android SDK: /Users/ashleyg/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Not Installed

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.iOS ===

Version: 10.4.0.114 (Visual Studio Enterprise)
Hash: 22d559f
Branch: cycle9
Build date: 2017-02-03 16:04:59-0500

=== Xamarin.Mac ===

Version: 3.0.0.384 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 602001809
Git revision: bd75dae9aa2e6041309bc6a4f6140cc099ea2e98
Build date: 2017-02-03 15:04:22-05
Xamarin addins: bf31ec767f2a60b3e34647baf33798b26c9336aa
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.11.6
Darwin ashleyg.local 15.6.0 Darwin Kernel Version 15.6.0
    Thu Jun 23 18:25:34 PDT 2016
    root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
Comment 4 sh.naz 2017-06-05 08:24:02 UTC
I am experiencing somewhat the same exception, but it occurs when I set App.MainPage to an instance of tabbed page, see pasted stacktrace below. 

@DaveFriedel, did you manage to resolve this matter in your project?


Xamarin caused by: Java.Lang.RuntimeException: Unable to find resource ID #0x2
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ac4440d3f1ca467280b653b39b3bf2cb>:0 
  at Java.Interop.JniEnvironment+InstanceMethods.CallBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00084] in <80fa9171ff6d4bf69e336c3039e810ab>:0 
  at Android.Runtime.JNIEnv.CallBooleanMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <bfaa5df3f7c8454db3bd11f2144d2657>:0 
  at Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions () [0x00033] in <27c17fe440cf491ba8255bcefade6e02>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.Dispose (System.Boolean disposing) [0x00083] in <15c9790557774c809371f43133cc42c4>:0 
  at Java.Lang.Object.Dispose () [0x00000] in <bfaa5df3f7c8454db3bd11f2144d2657>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x0003f] in <15c9790557774c809371f43133cc42c4>:0 
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0001a] in <15c9790557774c809371f43133cc42c4>:0 
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.AppOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x0001e] in <15c9790557774c809371f43133cc42c4>:0 
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <051840eae40a4636884ee6bc6a0d140a>:0 
  at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <051840eae40a4636884ee6bc6a0d140a>:0 
  at Xamarin.Forms.Application.set_MainPage (Xamarin.Forms.Page value) [0x0008b] in <051840eae40a4636884ee6bc6a0d140a>:0 
  at Field.App+<>c__DisplayClass9_0.<ShowModulesTabbedPage>b__0 () [0x00000] in <0d9f2782f9034497a113f1437304c507>:0 
  at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in <bfaa5df3f7c8454db3bd11f2144d2657>:0 
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <bfaa5df3f7c8454db3bd11f2144d2657>:0 
  at (wrapper dynamic-method) System.Object:2d3b7f18-e518-4fd0-ac2d-7aa9c887e514 (intptr,intptr)
  --- End of managed Java.Lang.RuntimeException stack trace ---
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x2
	at android.content.res.Resources.getResourceName(Resources.java:2235)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1059)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
	at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
	at mono.java.lang.RunnableImplementor.n_run(Native Method)
	at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5417)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Comment 5 Dave Friedel 2017-06-05 08:35:00 UTC
@sh.naz I was able to work around it by forcing all the tabs to load and not allow them to be destroyed.


***** snippet
        protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
        {
            base.OnElementChanged(e);

            tabbedPage = e.NewElement as MainTab;
            
            viewPager = (ViewPager)GetChildAt(0);
            viewPager.OffscreenPageLimit = 10;   <---- here

Hope this helps.
Comment 6 develop 2018-03-15 10:58:37 UTC
@Dave Friedel

I've implemented a custom renderer for the TabbedPage that does what you describe, with the difference that I've set OffscreenPageLimit to tabbedPage.Children.Count and it did work around the problem, thanks! Curiously, setting the OffscreenPageLimit to Java.Lang.Integer.MaxValue did not.

Perhaps some day Xamarin.Forms successfuly abstracts Android, in the meantime, on to the next Xamarin.Android bug 57728
Comment 7 Dave Friedel 2018-03-20 01:09:14 UTC
@develop@media-soft.info 

I am glad it worked for you.

I used 10 because my app is creating tabs on the fly and I needed a buffer.  When I set them to the current number of tabs (which is perfect if your tab count doesn't change), Xamarin would still throw the error after the initial tab set was instantiated.

I feel ya on the bug hunt :)