Bug 55748 - Receiving intermittent errors “Unable to Find Resource ID” when starting up application.
Summary: Receiving intermittent errors “Unable to Find Resource ID” when starting up a...
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 7.2 (15.1)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-04-28 20:32 UTC by Ammar Mheir
Modified: 2017-08-23 21:05 UTC (History)
5 users (show)

Tags: bb
Is this bug a regression?: ---
Last known good build:

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description Ammar Mheir 2017-04-28 20:32:20 UTC
##Overview

Running into a random error within a Xamarin.Forms Android application. "Unable to find Resource ID" 
This occurs when the application is first starting up but is random and has been difficult to replicate. Working on trying to provide a sample that will replicate this issue into the bug report as soon as possible but since the error is random in nature it has been proven difficult. We are observing these errors logged into HockeyApp. 

##Observed Behavior

The following are just two of the error messages that have been logged into HockeyApp from the production application:

>android.content.res.Resources$NotFoundException: Unable to find resource ID #0x2
>android.content.res.ResourcesImpl.getResourceName()ResourcesImpl.java:228
>android.content.res.Resources.getResourceName()Resources.java:1893
>android.support.v4.app.FragmentManagerImpl.moveToState()FragmentManager.java:1059
>android.support.v4.app.FragmentManagerImpl.moveToState()FragmentManager.java:1252
>android.support.v4.app.BackStackRecord.run()BackStackRecord.java:742
>android.support.v4.app.FragmentManagerImpl.execPendingActions()FragmentManager.java:1617
>android.support.v4.app.FragmentManagerImpl.executePendingTransactions()FragmentManager.java:570
>mono.java.lang.RunnableImplementor.n_run(Native Method)
>mono.java.lang.RunnableImplementor.run()RunnableImplementor.java:30
>android.os.Handler.handleCallback()Handler.java:751
>android.os.Handler.dispatchMessage()Handler.java:95
>android.os.Looper.loop()Looper.java:154
>android.app.ActivityThread.main()ActivityThread.java:6123
>java.lang.reflect.Method.invoke(Native Method)
>com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:867
>com.android.internal.os.ZygoteInit.main()ZygoteInit.java:757
>Xamarin caused by: Java.Lang.RuntimeException: Unable to find resource ID #0x2
>System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<c5333b9c383c41718f537a57f33c8c23>:0
>Java.Interop.JniEnvironment.InstanceMethods.CallBooleanMethod(JniObjectReference instance, JniMethodInfo method)<d70c1d79281f492893310943dd6a1001>:0
>Android.Runtime.JNIEnv.CallBooleanMethod(IntPtr jobject, IntPtr jmethod)<d24c5dd5bee44f5089f4fada8c91c4ef>:0
>Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions()<7f5a9f35ef814f379eae6c435b6b4cf9>:0
>Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.Dispose(bool disposing)<e674191d12384fc980862a149235d5ef>:0
>Java.Lang.Object.Dispose()<d24c5dd5bee44f5089f4fada8c91c4ef>:0
>Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage(Page newRoot)<e674191d12384fc980862a149235d5ef>:0
>Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage(Page page)<e674191d12384fc980862a149235d5ef>:0
>Xamarin.Forms.Platform.Android.FormsAppCompatActivity.AppOnPropertyChanged(object sender, PropertyChangedEventArgs args)<e674191d12384fc980862a149235d5ef>:0
>Xamarin.Forms.BindableObject.OnPropertyChanged(string propertyName)<33e6b507a09147e7ba4107991c20f250>:0
>Xamarin.Forms.Element.OnPropertyChanged(string propertyName)<33e6b507a09147e7ba4107991c20f250>:0
>Xamarin.Forms.Application.set_MainPage(Page value)<33e6b507a09147e7ba4107991c20f250>:0
>MRV.AppCliente.Mobile.Forms.Components.NavegacaoService.NavigateTo(string chaveDaPagina, object parametros)<a3749e65e5674e1e8ea86ba88f2e4473>:0
>MRV.AppCliente.Mobile.Forms.Components.NavegacaoService.NavigateTo(string chaveDaPagina)<a3749e65e5674e1e8ea86ba88f2e4473>:0
>MRV.AppCliente.Mobile.Forms.Views.LandingPage.<OnAppearing>d__4.MoveNext()<a3749e65e5674e1e8ea86ba88f2e4473>:0
>Android.App.SyncContext.<Post>c__AnonStorey0.<>m__0()<d24c5dd5bee44f5089f4fada8c91c4ef>:0
>Java.Lang.Thread.RunnableImplementor.Run()<d24c5dd5bee44f5089f4fada8c91c4ef>:0
>Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)<d24c5dd5bee44f5089f4fada8c91c4ef>:0
>at (wrapper dynamic-method) System.Object:408a5250-3f9d-4c59-a366-c44773520c40 (intptr,intptr)

And the second error which contains some device information:

>Package: br.com.mrv.meumrv
>Version Code: 59
>Version Name: 1.0.0
>Android: 4.1.2
>Android Build: JZO54K.I8262BVJANB1
>Manufacturer: samsung
>Model: GT-I8262B
>Thread: main-1
>CrashReporter Key: 77427705-8BFF-F7A2-2970-BFF55626B11FBB29CA07
>Start Date: Tue Mar 21 13:08:33 GMT-03:00 2017
>Date: Tue Mar 21 13:09:50 GMT-03:00 2017

>android.content.res.Resources$NotFoundException: Unable to find resource ID #0x401
>	at android.content.res.Resources.getResourceName(Resources.java:2520)
>	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$1.run(FragmentManager.java:517)
>	at android.os.Handler.handleCallback(Handler.java:615)
>	at android.os.Handler.dispatchMessage(Handler.java:92)
>	at android.os.Looper.loop(Looper.java:137)
>	at android.app.ActivityThread.main(ActivityThread.java:4960)
>	at java.lang.reflect.Method.invokeNative(Native Method)
>	at java.lang.reflect.Method.invoke(Method.java:511)
>	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
>	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
>	at dalvik.system.NativeStart.main(Native Method)

##Expected Behavior

Application runs without crashing randomly with the above errors at startup

##Version Information

Microsoft Visual Studio Professional 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586
Installed Version: Professional

Xamarin   4.4.0.34 (3f99c5a)
Xamarin.Android   7.2.0.7 (b16fb82)

##Additional information

Was hoping to just gather any additional information or useful tips on where to investigate this issue and effectively troubleshooting it. The random nature of this crash has made is very hard to replicate when debugging and we are not sure if this is potentially a bug within the framework or something else.
Comment 1 Marek Mierzwa 2017-06-01 13:48:37 UTC
I observe exactly the same random errors in my app:

```
Java.Lang.RuntimeException: Unable to find resource ID #0x3
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<d4ea4853a3c746818675f28bc6a39dfd>:0
Java.Interop.JniEnvironment.InstanceMethods.CallBooleanMethod(JniObjectReference instance, JniMethodInfo method)<38668b6a4482406d8ca6122349ee84b4>:0
Android.Runtime.JNIEnv.CallBooleanMethod(IntPtr jobject, IntPtr jmethod)<5a04fc5e5569456ba2072af9fde07b2f>:0
Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions()<27c17fe440cf491ba8255bcefade6e02>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.Dispose(bool disposing)<1481f85a917c4f2b882ea161e9bc082f>:0
Java.Lang.Object.Dispose()<5a04fc5e5569456ba2072af9fde07b2f>:0
Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage(Page newRoot)<1481f85a917c4f2b882ea161e9bc082f>:0
Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage(Page page)<1481f85a917c4f2b882ea161e9bc082f>:0
Xamarin.Forms.Platform.Android.FormsAppCompatActivity.AppOnPropertyChanged(object sender, PropertyChangedEventArgs args)<1481f85a917c4f2b882ea161e9bc082f>:0
Xamarin.Forms.BindableObject.OnPropertyChanged(string propertyName)<0f1ce60dbc6b4e24af01294c7acf41c6>:0
Xamarin.Forms.Element.OnPropertyChanged(string propertyName)<0f1ce60dbc6b4e24af01294c7acf41c6>:0
Xamarin.Forms.Application.set_MainPage(Page value)<0f1ce60dbc6b4e24af01294c7acf41c6>:0
MyMd.Mobile.Core.PageModels.LoginPageModel.ShowAppPage()<aee9d2059f9c44a2a324444ecfb0977b>:0
MyMd.Mobile.Core.PageModels.LoginPageModel.OnNavigated(LoginPage page, CookieNavigatedEventArgs eventArgs)<aee9d2059f9c44a2a324444ecfb0977b>:0
System.Reflection.MonoMethod.InternalInvoke(MonoMethod, object, object[], ref Exception)(wrapper managed-to-native)
System.Reflection.MonoMethod.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)<d4ea4853a3c746818675f28bc6a39dfd>:0
--- End of inner exception stack trace ---
System.Reflection.MonoMethod.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)<d4ea4853a3c746818675f28bc6a39dfd>:0
System.Reflection.MethodBase.Invoke(object obj, object[] parameters)<d4ea4853a3c746818675f28bc6a39dfd>:0
Xamarin.Forms.MessagingCenter.Subscription.InvokeCallback(object sender, object args)<0f1ce60dbc6b4e24af01294c7acf41c6>:0
Xamarin.Forms.MessagingCenter.InnerSend(string message, Type senderType, Type argType, object sender, object args)<0f1ce60dbc6b4e24af01294c7acf41c6>:0
Xamarin.Forms.MessagingCenter.Send<TSender, TArgs>(TSender sender, string message, TArgs args)<0f1ce60dbc6b4e24af01294c7acf41c6>:0
MyMd.Mobile.Core.Pages.LoginPage.ServiceWebView_OnNavigated(object sender, CookieNavigatedEventArgs args)<aee9d2059f9c44a2a324444ecfb0977b>:0
MyMd.Mobile.Core.Views.CookieWebView.OnNavigated(CookieNavigatedEventArgs args)<aee9d2059f9c44a2a324444ecfb0977b>:0
MyMd.Mobile.Droid.Renderers.CookieWebViewClient.OnPageFinished(WebView view, string url)<0b83c159c9834fbca54f9c624b10be78>:0
Android.Webkit.WebViewClient.n_OnPageFinished_Landroid_webkit_WebView_Ljava_lang_String_(IntPtr jnienv, IntPtr native__this, IntPtr native_view, IntPtr native_url)<5a04fc5e5569456ba2072af9fde07b2f>:0
at (wrapper dynamic-method) System.Object:ae92c196-8d3b-435f-9a52-68ad774ec014 (intptr,intptr,intptr,intptr)
md5af2ff16caad23ac3babe8f19424b03f2.CookieWebViewClient.n_onPageFinished(Native Method)
md5af2ff16caad23ac3babe8f19424b03f2.CookieWebViewClient.onPageFinished()CookieWebViewClient.java:40
com.android.webview.chromium.WebViewContentsClientAdapter.onPageFinished()WebViewContentsClientAdapter.java:545
org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage()AwContentsClientCallbackHelper.java:201
android.os.Handler.dispatchMessage()Handler.java:102
android.os.Looper.loop()Looper.java:145
android.app.ActivityThread.main()ActivityThread.java:5951
java.lang.reflect.Method.invoke(Native Method)
java.lang.reflect.Method.invoke()Method.java:372
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1388
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1183
```

## Version Information

Version Code: 4775
Version Name: 1.3.0.4775
Android: 5.0.1
Android Build: LRX22C.I9515XXS1BPL2
Manufacturer: samsung
Model: GT-I9515
Thread: main-1
CrashReporter Key: C1E426D7-15AD-6A13-CE0A-CC76FEE00AA3132F40E1
Start Date: Thu Jun 01 09:21:49 GMT+02:00 2017
Date: Thu Jun 01 09:22:32 GMT+02:00 2017
Format: Xamarin
Comment 2 Marek Mierzwa 2017-06-01 21:03:55 UTC
The resource number also seems to be more or less random - so far I found #0x8 and #0x3 like above.
Comment 3 Marek Mierzwa 2017-06-02 08:51:47 UTC
Seems to be similar to https://bugzilla.xamarin.com/show_bug.cgi?id=42815 but there's no MasterDetail type navigation in my app
Comment 4 sh.naz 2017-06-05 09:07:23 UTC
Hey guys, I am experiencing the same crashes in my app. We newly updated Xamarin Forms to version 2.3.4.231. Before our update we did not have this issue. I updated my app yesterday and already am up to 24 crashes because of this issue.

Are there any workarounds to this?

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 Mark McLemore 2017-06-26 22:01:12 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue, we would very much appreciate it.

For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d
Comment 6 Cody Beyer (MSFT) 2017-08-23 21:05:07 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!