Error Inflating Class Android.Support.V4.View.Viewpager

Error inflating class

Make sure that you place your libraries in a common folder such as libs in your project.

Right click on the jar, then select Build Path and click on Add to Build Path.

That will add your library to your project. If everything is correct, you can see it in a generated "folder" in the project called "Referenced Libraries"

ClassNotFoundException re when inflating

If you are using implementation "androidx.viewpager:viewpager:1.0.0"

Also, change in XML file too


Binary XML file line #18: Error inflating class



No static method setOnApplyWindowInsetsListener exception in Android

I had same issue. I tried to run my code on another system with latest downloaded version of Android SDK (API 24). compileSdkVersion of my code was 23. So, what I did is I opened app.iml file (located in app module) and found version of components installed and updated them in build.gradle(app module) file.


compile ''


compile ''

And also updated compileSdkVersion to 24, buildToolsVersion to 24.0.1, targetSdkVersion to 24.
Now my code runs fine.

Hope it helps.

custom view pager :Error inflating class

it should be


instead of


RuntimeException: Error inflating class android.suppoort.v4.view.ViewPager

In your main_activity.xml, you have the class name spelled wrong.


should be

How to fix ViewPager class inflating exception which is reproducable only with the released Google Play Store version

I went ahead and converted ViewPager used by the app to ViewPager2 following this guide and my common sense:

Here is the commit:
Apparently this removed all ambiguity and chance for the underlying frameworks to pull out an inappropriately old ViewPager "rabbit from the magic hat".

Related Topics

Leave a reply