Java.Lang.Illegalaccesserror: Class Ref in Pre-Verified Class Resolved to Unexpected Implementation Getting While Running Test Project

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation after adding AppCompat to stable application

You should include all your annotation classes in main dex.

The symptom is different, but the solution is the same as for this question:

How do you calculate which classes to put in your main-dex-list file?

There's a script that can generate it for you. I wrote a blogpost that shows how to use it.

Update (10/31/2014):

Gradle plugin v0.14.0 now does it automatically. See my answer here.

Android Error Class ref in pre-verified class resolved to unexpected implementation

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 instrumentation testing : IllegalAccessError

First, follow the Libraries section on android-maven-plugin wiki page here:

If your project set-up contains libraries then those too need to be added as <scope>provided</scope> otherwise they will be added to the test which will result in a duplication the error «Class ref in pre-verified class resolved to unexpected implementation».

... ...

Note Bug # 142, only Libraries with <packaging>jar</packaging> will work at this point.

Then right-click on your UnderTestProject, click Build Path -> Configure Build Path, tick Maven Dependencies in the Order and Export tab:Sample Image

This works for me, hope it helps.



Related Topics



Leave a reply



Submit