预验证类中的 Android 错误类引用解析为意外实现 [英] Android Error Class ref in pre-verified class resolved to unexpected implementation

查看:22
本文介绍了预验证类中的 Android 错误类引用解析为意外实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android Espresso 测试中遇到过这个问题.但这在运行/编译时效果很好.我知道此错误有多个线程,但我无法找到与我的情况相符的修复程序.我目前正在处理一个

I've encountered this problem on Android Espresso testing. But this works well when run/compile. I know this error has several threads but I have not been able to find a fix that matches my situation. I am currently dealing with a

"java.lang.IllegalAccessError: 预验证类中的类引用解决了意外实施".

"java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation".

我已经添加了

androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
   exclude group: 'com.android.support', module: 'support-v4'
}

但是还是不行.有人可以帮我解决这个问题.谢谢.

But it's still not working. Can somebody help me with this problem. Thanks.

这是我的依赖项

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    /*Android Testing*/
    androidTestCompile 'com.android.support.test:runner:0.3'
    androidTestCompile 'com.android.support.test:rules:0.3'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
    androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.1'
    androidTestCompile 'com.android.support:support-annotations:23.0.1'
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.android.support:support-v4:23.0.+'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.18'
    compile 'commons-codec:commons-codec:1.9'

    /*Showcase view for Facebook Intregation*/
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    /*Showcase view for SwipeRefresh*/
    compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
    /*Multidex*/
    compile 'com.android.support:multidex:1.0.1'
    /*Crashlytics*/
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
}

推荐答案

好久不见,终于找到了 gradle 1.5 的解决方案.我搬到 Robotium 并尝试使用此代码.但我认为这也适用于 Espresso.在这里,

Finally after a long time, I find a solution for gradle 1.5. I move to Robotium and try this code. But I think this will work too with Espresso. Here it is,

androidTestCompile fileTree(dir: 'libs', include:'robotium-solo-5.3.0.jar')
androidTestCompile ('com.android.support:multidex-instrumentation:1.0.1') {
    exclude group: 'com.android.support', module: 'multidex' }

project.configurations.all { config ->
    if (config.name.contains("AndroidTest")) {
        config.resolutionStrategy.eachDependency { details ->
            if (details.requested.name == "multidex") {
                details.useTarget("de.felixschulze.teamcity:teamcity-status-message-helper:1.2")
            }
        }
    }
}

这篇关于预验证类中的 Android 错误类引用解析为意外实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆