2

I'm receiving the following runtime crash only on Samsung devices running Android 11 API 30

Fatal Exception: java.lang.AbstractMethodError: abstract method "android.view.WindowInsets android.view.WindowInsetsAnimation$Callback.onProgress(android.view.WindowInsets, java.util.List)"
       at android.view.View.dispatchWindowInsetsAnimationProgress(View.java:12131)

This function was added on api 30, I can't find anything problematic in the code, as it also works on all other devices.

if (Build.VERSION.SDK_INT >= 30) {
    ViewCompat.setWindowInsetsAnimationCallback(
        binding.root,
        object : WindowInsetsAnimationCompat.Callback(DISPATCH_MODE_STOP) {
          override fun onProgress(insets: WindowInsetsCompat, runningAnimations: MutableList<WindowInsetsAnimationCompat>): WindowInsetsCompat {
            val inset = insets.getInsets(Type.ime())
            val animation = runningAnimations.firstOrNull()

            if (animation != null) {
                binding.root.updatePadding(bottom = maxOf(navigationBarHeight, inset.bottom))
            }

            return insets
       }
   })
}

What I'm currently thinking is that Samsung didn't implement AOSP 30 properly. A possible fix that I can think of is to not use the animation callback for the ime height... I'm not very happy about it but I also don't have a better idea of how to fix it.

Gil Goldzweig
  • 1,809
  • 1
  • 13
  • 26

0 Answers0