I've recently migrated my project to AndroidX. Now when I open specific page of the app that has code below, the app Crashes
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"
>
Error in Logcat:
android.view.InflateException: Binary XML file line #119: Could not inflate Behavior subclass android.support.design.widget.AppBarLayout$ScrollingViewBehavior
Caused by: java.lang.RuntimeException: Could not inflate Behavior subclass android.support.design.widget.AppBarLayout$ScrollingViewBehavior
I think I must replace this behavior with it's alternative in AndroidX. But what is that alternative code? I searched in https://developer.android.com/jetpack/androidx/migrate. But didn't find AppBarLayout.
Thanks in advance.
I found the solution.
The layout_behavior
line must be replace with this:
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
make sure 'material' dependency exists in build.gradle:
implementation 'com.google.android.material:material:1.2.1'