Bug 55230 - setStateListAnimator TargetInvocationException Crash in 2.3.5.233-pre1
Summary: setStateListAnimator TargetInvocationException Crash in 2.3.5.233-pre1
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Chris King
URL:
Depends on:
Blocks:
 
Reported: 2017-04-14 19:52 UTC by daniel.bergquist
Modified: 2017-07-13 08:00 UTC (History)
7 users (show)

See Also:
Tags: ac
Is this bug a regression?: Yes
Last known good build: 2.3.4


Attachments
Reproducable case (64.41 KB, application/zip)
2017-04-15 13:44 UTC, daniel.bergquist
Details

Description daniel.bergquist 2017-04-14 19:52:20 UTC
I updated a project from Xamarin.Forms version 2.3.3.193 to 2.3.5.233-pre1. Prior to the update the project ran as expected.

After the update the project experienced the following crash on a Samsung Tab 3 Lite running Android 4.2.2. Running the project on a Nexus 5X running 7.x did not present the crash.


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Java.Lang.NoSuchMethodError: no method with name='setStateListAnimator' signature='(Landroid/animation/StateListAnimator;)V' in class Landroid/support/v7/widget/AppCompatButton;
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at Java.Interop.JniEnvironment+InstanceMethods.GetMethodID (Java.Interop.JniObjectReference type, System.String name, System.String signature) [0x00068] in /Users/builder/data/lanes/4468/b16fb820/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11240
  at Java.Interop.JniType.GetInstanceMethod (System.String name, System.String signature) [0x0000f] in /Users/builder/data/lanes/4468/b16fb820/source/Java.Interop/src/Java.Interop/Java.Interop/JniType.cs:230
  at Java.Interop.JniPeerMembers+JniInstanceMethods.GetMethodInfo (System.String encodedMember) [0x0003a] in /Users/builder/data/lanes/4468/b16fb820/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:94
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0004f] in /Users/builder/data/lanes/4468/b16fb820/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:30
  at Android.Views.View.set_StateListAnimator (Android.Animation.StateListAnimator value) [0x0002c] in /Users/builder/data/lanes/4468/b16fb820/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Android.Views.View.cs:9505
  at Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer.Initialize () <0x6f958220 + 0x00057> in <e6433e4b21ac4b38a1eaa5cf0f3d9c65>:0
  at Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer..ctor () [0x00022] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\MasterDetailPageRenderer.cs:368
  at at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:661
  at java.lang.NoSuchMethodError: no method with name='setStateListAnimator' signature='(Landroid/animation/StateListAnimator;)V' in class Landroid/support/v7/widget/AppCompatButton;
  at at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onCreateView(Native Method)
  at at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onCreateView(FragmentContainer.java:51)
  at at android.support.v4.app.Fragment.performCreateView(Fragment.java:2189)
  at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
  at at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
  at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
  at at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
  at at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
  at at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
  at at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
  at at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
  at at android.support.v4.app.Fragment.performStart(Fragment.java:2211)
  at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1340)
  at at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:1132)
  at at android.support.v4.app.FragmentManagerImpl.startPendingDeferredFragments(FragmentManager.java:1632)
  at at android.support.v4.app.FragmentManagerImpl.doPendingDeferredStart(FragmentManager.java:2457)
  at at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1985)
  at at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)
  at at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
  at at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
  at at android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
  at at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1642)
  at at android.view.View.measure(View.java:16515)
  at at md5270abb39e60627f0f200893b490a1ade.TabbedPageRenderer.n_onLayout(Native Method)
  at at md5270abb39e60627f0f200893b490a1ade.TabbedPageRenderer.onLayout(TabbedPageRenderer.java:71)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:28)
  at at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_onLayout(Native Method)
  at at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.onLayout(PlatformRenderer.java:63)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1021)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1694)
  at at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1552)
  at at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
  at at android.view.View.layout(View.java:14938)
  at at android.view.ViewGroup.layout(ViewGroup.java:4601)
  at at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2212)
  at at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2026)
  at at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1236)
  at at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5160)
  at at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
  at at android.view.Choreographer.doCallbacks(Choreographer.java:591)
  at at android.view.Choreographer.doFrame(Choreographer.java:561)
  at at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
  at at android.os.Handler.handleCallback(Handler.java:725)
  at at android.os.Handler.dispatchMessage(Handler.java:92)
  at at android.os.Looper.loop(Looper.java:176)
  at at android.app.ActivityThread.main(ActivityThread.java:5365)
  at at java.lang.reflect.Method.invokeNative(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:511)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  at at dalvik.system.NativeStart.main(Native Method)
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00016] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:667
  at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000ca] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/ReferenceSources/RuntimeType.cs:179
  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x0001a] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/ReferenceSources/RuntimeType.cs:153
  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x0002a] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/rttype.cs:5638
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00040] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/activator.cs:201
  at System.Activator.CreateInstance (System.Type type) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/activator.cs:134
  at Xamarin.Forms.Internals.Registrar`1[TRegistrable].GetHandler (System.Type type) [0x00015] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Registrar.cs:33
  at Xamarin.Forms.Internals.Registrar`1[TRegistrable].GetHandler[TOut] (System.Type type) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Registrar.cs:39
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\EntryRenderer.cs:47
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\GestureManager.cs:54
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\LabelRenderer.cs:38
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\GestureManager.cs:46
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\ImageRenderer.cs:134
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00026] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\VisualElementRenderer.cs:96
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0002d] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\LabelRenderer.cs:292
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\EntryRenderer.cs:50
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\GestureManager.cs:54
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\LabelRenderer.cs:38
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\GestureManager.cs:46
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\ImageRenderer.cs:134
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00026] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\VisualElementRenderer.cs:96
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0002d] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\FastRenderers\LabelRenderer.cs:292
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) [0x0001b] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\EntryRenderer.cs:131
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00006] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\Resource.cs:28
  at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00022] in <7a2a36256f1648ecbd0c15a75bc5a349>:0
  at at (wrapper dynamic-method) System.Object:98ac830c-f0ce-4678-b2d6-722d37b11c50 (intptr,intptr,intptr,intptr,intptr)
Comment 1 Sam Oh 2017-04-14 20:08:29 UTC
https://developer.android.com/reference/android/animation/StateListAnimator.html

StateListAnimator added in api level 21.
Comment 2 Paul DiPietro [MSFT] 2017-04-14 20:58:49 UTC
Was this working on that very device prior to the update, and what does your layout consist of? I'm asking to make certain that Sam's comment above regarding the API level is not a direct cause.
Comment 3 daniel.bergquist 2017-04-14 21:04:58 UTC
Prior to the update the project ran as expected on this device.

At the top most layer the layout is a tab page. Each tab has a navigation page to get the title header

First tab is a carousel page with Webview children

Second tab has a vertical stack layout with three buttons and a list view as children

Third tab is a list view which starts out empty on the first launch of the app

Fourth tab is settings in a vertical stack layout with a two buttons in a horizontal stack view, a label in a frame (to get a border), and a slider.
Comment 4 daniel.bergquist 2017-04-14 21:06:10 UTC
By "layer" I mean "level"
Comment 5 Paul DiPietro [MSFT] 2017-04-14 21:12:41 UTC
Can you please verify that 2.3.4 stable works as expected, and possibly upload a reproduction? Based on the trace it appears that it has to do with the AppCompatButton, so if the reproduction can be cut down to whatever is actually causing the crash, that makes things much easier. More specifically meaning if you don't need particular tabs, or if you can just reproduce it in a single view.

If 2.3.4 works, then that will help verify that it's a 2.3.5 specific issue, which is a big first step.
Comment 6 daniel.bergquist 2017-04-15 00:31:37 UTC
Yes, 2.3.4 works as expected. I have attached a simple project that reproduces the issue. It seems that simply having a button causes the crash.
Comment 7 daniel.bergquist 2017-04-15 13:44:18 UTC
Created attachment 21562 [details]
Reproducable case
Comment 8 Eric Hamrick 2017-04-17 03:20:01 UTC
I have this same issue. I narrowed it down the Button control.  In the Github source for the button renderer I believe the exception is occurring because of the line: StateListAnimator = null; in ButtonRenderer.cs I'm receiving the issue on android 4.3/4.4 in genymotion emulator.
Comment 10 Rui Marinho 2017-04-19 16:50:59 UTC
Shoudl be fixed on 2.3.5-pre2
Comment 11 Saurabh Paunikar 2017-07-13 08:00:30 UTC
Verified on xamarin.form version 2.3.5.256-pre6. I was able to deployed attached project on different stimulator 4.3,4.4,6.0,7.0 etc

Note You need to log in before you can comment on or make changes to this bug.