- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个 android.support.v7.widget.RecyclerView 的子类。当我使用应用程序和测试时它工作正常。
但是,当我在我的 gradle 应用程序文件中包含 espresso-contrib 时,当我尝试运行相同的测试时出现异常。该应用程序仍然有效。同样的问题出现在 sdk 版本 21 和 22,在 armv 模拟器和设备上。使用 x86 模拟器它会出现段错误。
Gradle
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0'
异常
java.lang.IncompatibleClassChangeError: xxx.DashboardActivity$1
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at xxx.DashboardActivity.onCreate(DashboardActivity.java:54)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.support.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:346)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
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:5257)
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)
亚行日志
I/ActivityManager( 1229): START u0 {act=android.intent.action.MAIN flg=0x14000000 cmp=xxx/.activities.DashboardActivity} from uid 10059 on display 0
V/WindowManager( 1229): addAppToken: AppWindowToken{65964e3 token=Token{3f63d512 ActivityRecord{19743c9d u0 xxx/.activities.DashboardActivity t13}}} to stack=1 task=13 at 0
D/LifecycleMonitor( 2953): Lifecycle status change: xxx.activities.DashboardActivity@281384ef in: PRE_ON_CREATE
V/WindowManager( 1229): Adding window Window{2d974c1a u0 Starting xxx} at 2 of 7 (after Window{27a98488 u0 com.android.launcher/com.android.launcher2.Launcher})
W/RecyclerView( 2953): setScrollingTouchSlop(): bad argument constant 315513600; using default value
W/art ( 2953): Incompatible structural change detected: Structural change of android.support.v7.widget.RecyclerView$Adapter is hazardous (/data/dalvik-cache/x86/data@app@xxx-1@b
ase.apk@classes.dex at compile time, /data/dalvik-cache/x86/data@app@xxx.test-1@base.apk@classes.dex at runtime): Virtual method count off: 26 vs 25
W/art ( 2953): Landroid/support/v7/widget/RecyclerView$Adapter; (Compile time):
W/art ( 2953): Static fields:
W/art ( 2953): Instance fields:
W/art ( 2953): Z mHasStableIds
W/art ( 2953): Landroid/support/v7/widget/RecyclerView$AdapterDataObservable; mObservable
W/art ( 2953): Direct methods:
W/art ( 2953): <init>()V
W/art ( 2953): Virtual methods:
W/art ( 2953): bindViewHolder(Landroid/support/v7/widget/RecyclerView$ViewHolder;I)V
W/art ( 2953): createViewHolder(Landroid/view/ViewGroup;I)Landroid/support/v7/widget/RecyclerView$ViewHolder;
W/art ( 2953): getItemCount()I
W/art ( 2953): getItemId(I)J
W/art ( 2953): getItemViewType(I)I
W/art ( 2953): hasObservers()Z
W/art ( 2953): hasStableIds()Z
W/art ( 2953): notifyDataSetChanged()V
W/art ( 2953): notifyItemChanged(I)V
W/art ( 2953): notifyItemInserted(I)V
W/art ( 2953): notifyItemMoved(II)V
W/art ( 2953): notifyItemRangeChanged(II)V
W/art ( 2953): notifyItemRangeInserted(II)V
W/art ( 2953): notifyItemRangeRemoved(II)V
W/art ( 2953): notifyItemRemoved(I)V
W/art ( 2953): onAttachedToRecyclerView(Landroid/support/v7/widget/RecyclerView;)V
W/art ( 2953): onBindViewHolder(Landroid/support/v7/widget/RecyclerView$ViewHolder;I)V
W/art ( 2953): onCreateViewHolder(Landroid/view/ViewGroup;I)Landroid/support/v7/widget/RecyclerView$ViewHolder;
W/art ( 2953): onDetachedFromRecyclerView(Landroid/support/v7/widget/RecyclerView;)V
W/art ( 2953): onFailedToRecycleView(Landroid/support/v7/widget/RecyclerView$ViewHolder;)Z
W/art ( 2953): onViewAttachedToWindow(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V
W/art ( 2953): onViewDetachedFromWindow(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V
W/art ( 2953): onViewRecycled(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V
W/art ( 2953): registerAdapterDataObserver(Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;)V
W/art ( 2953): setHasStableIds(Z)V
W/art ( 2953): unregisterAdapterDataObserver(Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;)V
W/art ( 2953): Landroid/support/v7/widget/RecyclerView$Adapter; (Runtime):
W/art ( 2953): Static fields:
W/art ( 2953): Instance fields:
W/art ( 2953): Z mHasStableIds
W/art ( 2953): Landroid/support/v7/widget/RecyclerView$AdapterDataObservable; mObservable
W/art ( 2953): Direct methods:
W/art ( 2953): <init>()V
W/art ( 2953): Virtual methods:
W/art ( 2953): bindViewHolder(Landroid/support/v7/widget/RecyclerView$ViewHolder;I)V
W/art ( 2953): createViewHolder(Landroid/view/ViewGroup;I)Landroid/support/v7/widget/RecyclerView$ViewHolder;
W/art ( 2953): getItemCount()I
W/art ( 2953): getItemId(I)J
W/art ( 2953): getItemViewType(I)I
W/art ( 2953): hasObservers()Z
W/art ( 2953): hasStableIds()Z
W/art ( 2953): notifyDataSetChanged()V
W/art ( 2953): notifyItemChanged(I)V
W/art ( 2953): notifyItemInserted(I)V
W/art ( 2953): notifyItemMoved(II)V
W/art ( 2953): notifyItemRangeChanged(II)V
W/art ( 2953): notifyItemRangeInserted(II)V
W/art ( 2953): notifyItemRangeRemoved(II)V
W/art ( 2953): notifyItemRemoved(I)V
W/art ( 2953): onAttachedToRecyclerView(Landroid/support/v7/widget/RecyclerView;)V
W/art ( 2953): onBindViewHolder(Landroid/support/v7/widget/RecyclerView$ViewHolder;I)V
W/art ( 2953): onCreateViewHolder(Landroid/view/ViewGroup;I)Landroid/support/v7/widget/RecyclerView$ViewHolder;
W/art ( 2953): onDetachedFromRecyclerView(Landroid/support/v7/widget/RecyclerView;)V
W/art ( 2953): onViewAttachedToWindow(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V
W/art ( 2953): onViewDetachedFromWindow(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V
W/art ( 2953): onViewRecycled(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V
W/art ( 2953): registerAdapterDataObserver(Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;)V
W/art ( 2953): setHasStableIds(Z)V
W/art ( 2953): unregisterAdapterDataObserver(Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;)V
I/art ( 2953): Rejecting re-init on previously-failed class java.lang.Class<xxx.models.JSONArrayRecyclerViewAdapter>
I/art ( 2953): Rejecting re-init on previously-failed class java.lang.Class<xxx.models.JSONArrayRecyclerViewAdapter>
I/art ( 2953): Rejecting re-init on previously-failed class java.lang.Class<xxx.activities.DashboardActivity$1>
I/art ( 2953): Rejecting re-init on previously-failed class java.lang.Class<xxx.activities.DashboardActivity$1>
D/AndroidRuntime( 2953): Shutting down VM
E/MonitoringInstrumentation( 2953): Exception encountered by: Thread[main,5,main]. Dumping thread state to outputs and pining for the fjords.
E/MonitoringInstrumentation( 2953): java.lang.IncompatibleClassChangeError: xxx.activities.DashboardActivity$1
E/MonitoringInstrumentation( 2953): at dalvik.system.DexFile.defineClassNative(Native Method)
E/MonitoringInstrumentation( 2953): at dalvik.system.DexFile.defineClass(DexFile.java:226)
E/MonitoringInstrumentation( 2953): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
E/MonitoringInstrumentation( 2953): at dalvik.system.DexPathList.findClass(DexPathList.java:321)
E/MonitoringInstrumentation( 2953): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
E/MonitoringInstrumentation( 2953): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/MonitoringInstrumentation( 2953): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/MonitoringInstrumentation( 2953): at xxx.activities.DashboardActivity.onCreate(DashboardActivity.java:54)
E/MonitoringInstrumentation( 2953): at android.app.Activity.performCreate(Activity.java:5990)
E/MonitoringInstrumentation( 2953): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
E/MonitoringInstrumentation( 2953): at android.support.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:346)
E/MonitoringInstrumentation( 2953): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
E/MonitoringInstrumentation( 2953): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
E/MonitoringInstrumentation( 2953): at android.app.ActivityThread.access$800(ActivityThread.java:151)
E/MonitoringInstrumentation( 2953): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
E/MonitoringInstrumentation( 2953): at android.os.Handler.dispatchMessage(Handler.java:102)
E/MonitoringInstrumentation( 2953): at android.os.Looper.loop(Looper.java:135)
E/MonitoringInstrumentation( 2953): at android.app.ActivityThread.main(ActivityThread.java:5257)
E/MonitoringInstrumentation( 2953): at java.lang.reflect.Method.invoke(Native Method)
E/MonitoringInstrumentation( 2953): at java.lang.reflect.Method.invoke(Method.java:372)
E/MonitoringInstrumentation( 2953): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/MonitoringInstrumentation( 2953): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
最佳答案
Espresso 依赖项已过时。已报告,将在未来修复。 https://code.google.com/p/android-test-kit/issues/detail?id=139
关于android - 包含 espresso-contrib :2. 0 时的 java.lang.IncompatibleClassChangeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29216327/
编译项目时,我得到这个晦涩的异常 Looking for precompiled archives. To disable, use -Dgwt.usearchives=false Loading
我使用 Byte Buddy (v0.5.2) 动态创建一个接口(interface)的“子类”(实际上,我想创建一个实现该接口(interface)的类)。在此类实例上调用的所有方法都应重定向到另一
当我尝试通过 IntelliJ 中的 Stream Trace 调试下面代码中的流时,调试器无法评估 foreach,因为抛出了下面的错误。我不知道它是关于什么的,代码本身运行良好。 完全更新了 In
我刚开始使用 Geb,在输入来自 Geb 之书的示例代码时遇到此错误: import geb.Browser Browser.drive { go "http://google.com/ncr
在我的一个类中使用函数“createBlobInfo”时,出现“IncompatibleClassChangeError”异常: java.lang.IncompatibleClassChangeEr
在学习了 Java 中的 Lambda 表达式之后,我尝试练习一些简单的示例。但仅在我的第一个示例中,我收到了以下错误。 Exception in thread "main" java.lang.In
关于 Google 新引入的统一原生广告和 this is the documentation link.,我们不断收到错误消息至少 0.2% 的错误来自这种情况,所以它实际上很重要,我不认为它也是
我正在使用 Admob 中介从多个不同的发布商发布商那里拉取广告。我的 flurry 横幅广告似乎没有被正确拉出。我在控制台日志中看到以下错误: java.lang.IncompatibleClass
从 android 市场,我得到以下崩溃报告。我在测试我的应用程序时没有找到。崩溃发生在 PasswordActivity 类中。我正在发送堆栈跟踪和代码。谁能告诉我崩溃发生在哪里以及为什么会发生?
我向我的 Android 项目添加了一个 espresso 测试,并在创建 ActivityTestRule 的行上遇到了 IncompatibleClassChangeError。我如何找出导致它的
Espresso 测试运行良好,但在尝试检查是否出现 toast 消息时,使用此代码 onView(withText(R.string.added_successfully_msg)).inRoot(
尝试使用ScalaCheck和ScalaTest编写测试时,我遇到了一个令人讨厌的异常。这是我的依赖项: libraryDependencies ++= Seq( "org.scalatest"
在运行测试用例时,出现此异常 java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.
This question already has answers here: What causes java.lang.IncompatibleClassChangeError? (18个回答)
我正在尝试在 Maven 项目上导入 CPLEX(使用 Ubuntu 16.04)。 所以我使用以下命令将 cplex.jar 添加到 Maven 存储库:mvn install:安装文件-Dgrou
我知道这个问题已经被问过了,但不知何故,在谷歌搜索了大约一个小时后,我找不到任何令人信服的解决方案。 我正在使用 apache-jena 从 url 加载 RDF 模型。我得到 Incompatibl
java.lang.IncompatibleClassChangeError: Superclass com.google.android.gms.dynamic.zzg of com.google.
将 3.1.0.RELEASE Spring WAR 文件部署到 Tomcat 服务器时发生以下错误: java.lang.IncompatibleClassChangeError: class or
我将 Java 库打包为 JAR,当我尝试从中调用方法时,它会抛出许多 java.lang.IncompatibleClassChangeError。这些错误似乎是随机出现的。哪些问题可能导致此错误?
我正在尝试将应用程序部署到 Windows 服务器上的 Tomcat 7。我设置了一个本地副本并使用 Eclipse 进行了测试,没有遇到任何问题,但是在生产服务器上我收到了 Incompatible
我是一名优秀的程序员,十分优秀!