作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 ongakuer/CircleIndicator用于添加 viewpager 指标的库。除了更改一个小的 code 之外,我按原样使用了示例代码。从 customViewpager.addOnPageChangeListener
到 customViewpager.setOnPageChangeListener
因为它显示编译错误。之后没有编译错误。
当我运行该 Activity 时,我立即收到以下错误:
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)
最佳答案
遇到与 RecyclerView.Adapter 类似的问题-
java.lang.NoSuchMethodError: No virtual method setAdapterCount ...
使缓存无效然后重新启动 Android Studio 解决了我的错误。 You can find directions to invalidate caches in IntelliJ (the software Android Studio is built upon) at this link .
关于android - NoSuchMethodError : No virtual method removeOnPageChangeListener 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30953820/
我是一名优秀的程序员,十分优秀!