I have recently starting seeing the following three errors during release builds using the R8 code shrinker:
R8 : warning : Missing class: android.view.WindowInsetsAnimationControlListener
R8 : warning : Missing class: android.view.WindowInsetsController$OnControllableInsetsChangedListener
R8 : warning : Missing class: android.view.WindowInsetsAnimation$Callback
The build completes and the app runs but I suspect that this is the cause of a number of crashes I've started to see on Google Play Console. I haven't been able to reproduce these crashes on my own devices (or emulator). From the limited stack trace they don't appear to be anything to do with my own code (I've included an example stack trace at the bottom of this post). That the stack trace appears to show an error related to view creation/rendering, and the R8 errors relate to android.view, is why I suspect they're related (that and the fact that they both started appearing at the same time...).
I've found a number of posts and bug reports related to R8 missing class warnings but nothing specific to these three and nothing that really helps. I've tried adding lines like the following to proguard.cfg but it hasn't helped.
-keep class android.view.** { *; }
Is anyone able to shed light on the problem?
android.runtime.JavaProxyThrowable: at Xamarin.Forms.Platform.Android.ListViewRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x00083] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d3] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in <2e0d929b7f78480c8db42fc55cca561c>:0
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) [0x000c4] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x0016c] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f0] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.ScrollViewContainer.set_ChildView (Xamarin.Forms.View value) [0x00041] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.ScrollViewRenderer.LoadContent () [0x00011] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.ScrollViewRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x000cf] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in <2e0d929b7f78480c8db42fc55cca561c>:0
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) [0x000c4] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x0016c] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f0] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, AndroidX.Fragment.App.FragmentManager fragmentManager, Android.Content.Context context) [0x00031] in <2e0d929b7f78480c8db42fc55cca561c>:0
at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x0001b] in <2e0d929b7f78480c8db42fc55cca561c>:0
at AndroidX.Fragment.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) [0x00020] in <4e81a5c29660454fa4f16aaaa8f6f3d0>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.51(intptr,intptr,intptr,intptr,intptr)
at crc64720bb2db43a66fe9.FragmentContainer.n_onCreateView (Native Method)
at crc64720bb2db43a66fe9.FragmentContainer.onCreateView (Unknown Source)
at androidx.fragment.app.Fragment.performCreateView (Unknown Source:15)
at androidx.fragment.app.FragmentStateManager.createView (Unknown Source:179)
at androidx.fragment.app.FragmentManager.moveToState (Unknown Source:237)
at androidx.fragment.app.FragmentManager.moveToState (Unknown Source:2)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState (Unknown Source:58)
at androidx.fragment.app.FragmentManager.moveToState (Unknown Source:47)
at androidx.fragment.app.BackStackRecord.executeOps (Unknown Source:186)
at androidx.fragment.app.FragmentManager.executeOps (Unknown Source:38)
at androidx.fragment.app.FragmentManager.executeOpsTogether (Unknown Source:119)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (Unknown Source:84)
at androidx.fragment.app.FragmentManager.execPendingActions (Unknown Source:21)
at androidx.fragment.app.FragmentManager$4.run (Unknown Source:3)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:236)
at android.app.ActivityThread.main (ActivityThread.java:8057)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:967)