Bug 43568 - AppCompat Theme with TabLayout Crashes Android 4.1.2 API 16
Summary: AppCompat Theme with TabLayout Crashes Android 4.1.2 API 16
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-08-21 02:43 UTC by kyle.spearrin
Modified: 2017-06-19 21:40 UTC (History)
8 users (show)

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


Attachments
A simple test to reproduce the crash. (47.67 KB, application/zip)
2016-08-21 02:43 UTC, kyle.spearrin
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 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 FIXED

Description kyle.spearrin 2016-08-21 02:43:50 UTC
Created attachment 17145 [details]
A simple test to reproduce the crash.

Following the tutorial "Adding AppCompat and Material Design" here https://developer.xamarin.com/guides/xamarin-forms/platform-features/android/appcompat/ causes Android 4.1 API 16 on my Nexus S to crash when switching between tabs.

See the attached simple project to easily reproduce. Interestingly, this does not happen when using Xamarin Forms 2.1 (the default version loaded by my visual studio when I was setting up this reproduction test). Once I updated it to 2.3.1 it started crashing like my real app.

The error received is "Android.Content.Res.Resources+NotFoundException: Unable to find resource ID #0x402"

08-20 22:29:10.101 I/MonoDroid(24848): UNHANDLED EXCEPTION:
08-20 22:29:10.113 I/MonoDroid(24848): Android.Content.Res.Resources+NotFoundException: Unable to find resource ID #0x402
08-20 22:29:10.113 I/MonoDroid(24848):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
08-20 22:29:10.113 I/MonoDroid(24848):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (JniObjectReference instance, JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x000a7] in /Users/builder/data/lanes/3415/7db2aac3/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12083 
08-20 22:29:10.113 I/MonoDroid(24848):   at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/builder/data/lanes/3415/7db2aac3/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:444 
08-20 22:29:10.113 I/MonoDroid(24848):   at Android.Support.V4.View.ViewPager.SetCurrentItem (Int32 item, Boolean smoothScroll) [0x000a4] in <filename unknown>:0 
08-20 22:29:10.113 I/MonoDroid(24848):   at Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer.ScrollToCurrentPage () [0x00000] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\TabbedPageRenderer.cs:267 
08-20 22:29:10.113 I/MonoDroid(24848):   at Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0001a] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\TabbedPageRenderer.cs:193 
08-20 22:29:10.113 I/MonoDroid(24848):   at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
08-20 22:29:10.117 I/MonoDroid(24848):   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Core\BindableObject.cs:137 
08-20 22:29:10.117 I/MonoDroid(24848):   at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Core\Element.cs:369 
08-20 22:29:10.117 I/MonoDroid(24848):   at Xamarin.Forms.MultiPage`1[T].OnPropertyChanged (System.String propertyName) [0x0009d] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Core\MultiPage.cs:151 
08-20 22:29:10.117 I/MonoDroid(24848):   at Xamarin.Forms.MultiPage`1[T].set_CurrentPage (Xamarin.Forms.T value) [0x00026] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Core\MultiPage.cs:81 
08-20 22:29:10.117 I/MonoDroid(24848):   at Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer.Android.Support.Design.Widget.TabLayout.IOnTabSelectedListener.OnTabSelected (Android.Support.Design.Widget.Tab tab) [0x00027] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\TabbedPageRenderer.cs:80 
08-20 22:29:10.117 I/MonoDroid(24848):   at Android.Support.Design.Widget.TabLayout+IOnTabSelectedListenerInvoker.n_OnTabSelected_Landroid_support_design_widget_TabLayout_Tab_ (IntPtr jnienv, IntPtr native__this, IntPtr native_tab) [0x00011] in <filename unknown>:0 
08-20 22:29:10.117 I/MonoDroid(24848):   at (wrapper dynamic-method) System.Object:d71d51fa-2dde-4c61-a208-38d1bc4a9797 (intptr,intptr,intptr)
08-20 22:29:10.117 I/MonoDroid(24848):   --- End of managed exception stack trace ---
08-20 22:29:10.117 I/MonoDroid(24848): android.content.res.Resources$NotFoundException: Unable to find resource ID #0x402
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.content.res.Resources.getResourceName(Resources.java:1648)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1059)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2046)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1989)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1430)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:732)
08-20 22:29:10.117 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.v4.view.ViewPager.populate(ViewPager.java:1177)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:608)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:570)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:562)
08-20 22:29:10.121 I/MonoDroid(24848): 	at md5270abb39e60627f0f200893b490a1ade.TabbedPageRenderer.n_onTabSelected(Native Method)
08-20 22:29:10.121 I/MonoDroid(24848): 	at md5270abb39e60627f0f200893b490a1ade.TabbedPageRenderer.onTabSelected(TabbedPageRenderer.java:87)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1025)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.design.widget.TabLayout.selectTab(TabLayout.java:995)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.design.widget.TabLayout$Tab.select(TabLayout.java:1272)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.support.design.widget.TabLayout$TabView.performClick(TabLayout.java:1377)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.view.View$PerformClick.run(View.java:16966)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.os.Handler.handleCallback(Handler.java:615)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.os.Handler.dispatchMessage(Handler.java:92)
08-20 22:29:10.121 I/MonoDroid(24848): 	at android.os.Looper.loop(Looper.java:137)
08-20 22:29:10.125 I/MonoDroid(24848): 	at android.app.ActivityThread.main(ActivityThread.java:4745)
08-20 22:29:10.125 I/MonoDroid(24848): 	at java.lang.reflect.Method.invokeNative(Native Method)
08-20 22:29:10.125 I/MonoDroid(24848): 	at java.lang.reflect.Method.invoke(Method.java:511)
08-20 22:29:10.125 I/MonoDroid(24848): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-20 22:29:10.125 I/MonoDroid(24848): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-20 22:29:10.125 I/MonoDroid(24848): 	at dalvik.system.NativeStart.main(Native Method)
08-20 22:29:10.148 D/Mono    (24848): DllImport searching in: '__Internal' ('(null)').
08-20 22:29:10.148 D/Mono    (24848): Searching for 'java_interop_jnienv_throw'.
08-20 22:29:10.148 D/Mono    (24848): Probing 'java_interop_jnienv_throw'.
08-20 22:29:10.148 D/Mono    (24848): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.
Comment 1 Matt DeKrey 2016-10-22 03:29:20 UTC
I am also having this issue. I verified it as far back as 2.2.0 (with various stack traces), occurring in the emulator.
Comment 2 E.Z. Hart [MSFT] 2017-01-09 17:26:19 UTC
Kyle,

Have you only observed this problem on a device, or does it also occur on emulators?

I've tested the repro with version 2.3.3.180 and could not reproduce the issue; do you still see the problem with the more recent version?
Comment 3 kyle.spearrin 2017-01-09 17:34:35 UTC
I have only been able to observe it on the specific device (Android 4.1 API 16, Nexus S), not on an emulator.

The other commenter (Matt) says he produced it on an emulator though.

I will have to re-test on most recent version since I haven't looked at this in a while. I removed support for < Android 4.4 on my app because of this bug.
Comment 4 Rui Marinho 2017-06-19 21:40:15 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.

Here are some reproduction best practices: https://gist.github.com/jassmith/92405c300e54a01dcc6d