Inflating class android.support.v4.widget.SwipeRefreshLayout
Because you are using AndroidX, your XML is referencing the wrong version of SwipeRefreshLayout
Change in your XML from android.support.v4.widget.SwipeRefreshLayout
to androidx.swiperefreshlayout.widget.SwipeRefreshLayout
I was stuck on the SwipeRefreshLayout
using AndroidX
I was not able to get Reference of SwipeRefreshLayout
in AndroidX
So I added implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
dependency in app level gradle file.
So in my case solution is,
Add the dependency in app level build.gradle file
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
This issue seems to happen when migrating to AndroidX as there are many build artifact to be changed when Migrating to AndroidX.
Solution 1: Do it manually
For exemple:
android.support.v4.widget.SwipeRefreshLayout
changed to => androidx.swiperefreshlayout.widget.SwipeRefreshLayout
You must update all the build artifact listed in Migrating to AndroidX
Solution 2: Automate on Android Studio 3.2+
As suggested in this same link, you could automate this process by selecting Refactor > Migrate to AndroidX from the menu bar.
ADDITIONAL INFO - The errors I had:
Error inflating class android.support.constraint.ConstraintLayout
element WebView is not allowed here