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:
This works for me, hope it helps.
Related Topics
Java.Lang.Noclassdeffounderror: Failed Resolution Of: Landroid/Support/V4/Os/Buildcompat
Broadcast Receiver Not Working in Android Oreo
Limitation on Texture Size? Android Open Gl Es 2.0
Why Is My Field 'Null' After Injection? How to Inject My Object
Could Not Launch Emulator in Android Studio
Android Design Support Library Expandable Floating Action Button(Fab) Menu
Android: What Is Better - Multiple Activities or Switching Views Manually
How to Show Popupwindow at Special Location
How to Set an Animated Gif File as Live Wallpaper in Android
Android M Fingerprintmanager.Ishardwaredetected() Returns False on a Samsung Galaxy S5
How to Use Broadcast Receiver in Different Applications in Android
Android Spinner Error:Android.View.Windowmanager$Badtokenexception: Unable to Add Window
Calledfromwrongthreadexception
How to Read/Write a Boolean When Implementing the Parcelable Interface
API to Automatically Upload APK to Google Play
How to Read Properties Defined in Local.Properties in Build.Gradle