I am using ongakuer/CircleIndicator library to add viewpager indicators. I have used the sample code as it is except changing a small code from customViewpager.addOnPageChangeListener
to customViewpager.setOnPageChangeListener
because it was showing compile error. After that there was no compile error.
When I run the activity, I straightaway get the following error:
java.lang.NoSuchMethodError: No virtual method removeOnPageChangeListener(Landroid/support/v4/view/ViewPager$OnPageChangeListener;)V in class Landroid/support/v4/view/ViewPager; or its super classes (declaration of 'android.support.v4.view.ViewPager' appears in /data/app/com.app.app-2/base.apk)
at me.relex.circleindicator.CircleIndicator.setViewPager(CircleIndicator.java:127)
at com.app.app.ViewpagerActivity.onCreate(ViewpagerActivity.java:24)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Faced a similar issue with RecyclerView.Adapter -
java.lang.NoSuchMethodError: No virtual method setAdapterCount ...
Invalidating caches and then restarting Android Studio resolved the error in my case. You can find directions to invalidate caches in IntelliJ (the software Android Studio is built upon) at this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With