Android - SwipeRefreshLayout import not found

just add this into yourbuld gradle module dependencies:

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

If you are using Material Library version 1.2.0 (like com.google.android.material:material:1.2.0-alpha03) , than you must import swipe refresh layout library too.

   implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'

To use SwipeRefreshLayout make sure you have updated Android Support Library. To check if it is updated follow below steps:

--> Open Eclipse

--> Go to Window-> Android SDK Manager.

--> In SDK Manager scroll down to bottom. Look for Android Support Library. If rev. is 19.1 then you are good to use SwipeRefreshLayout. If it is less than 19.1, then update Androd Support Library.

--> Once it is updated you can use SwipeRefreshLayout for new project. But you still cannot use SwipeRefreshLayout for existing projects.

Below are the steps to use SwipeRefreshLayout in existing project.

--> After updating Android Support Library, create new project.

--> Look for android-support-v4.jar in this project.

--> Copy android-support-v4.jar from new project and replace android-support-v4.jar of existing project with new project's android-support-v4.jar.

--> Now you can use SwipeRefreshLayout in existing project as well.


This is what worked for me...

If you are using google Material Library version 1.2.0 (like com.google.android.material:material:1.3.0-alpha01) , than you have to explicitly import swipe refresh layout library too.

implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'