Reputation: 503
We are having a strange issue running our android instrumentation tests. For some reason, it appears that a jar in a library project we use, is being re-obfuscated during the instrumentation test packaging, causing us to get the following error whenever we access a class in this jar
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
Our structure looks like this
+library
-- libs/obfuscated.jar
+app
-- instrumentTest
-- src/main/java/etc
-- build.gradle
-- compile dependency to library (which contains obfuscated jar)
We are using gradle 1.11, android gradle build tools plugin 19.0.1 and this problem only occurrs when running the instrumentation tests. The obfuscated app works fine.
Has anyone seen an issue similar to this before, or is there a way to stop the instrumentation test apk from being obfuscated all together? Currently, we run our instrumentation tests against an obfuscated version of our app, running them against a non obfuscated version is not an option for us.
Upvotes: 1
Views: 204
Reputation: 503
Renaming the test src root from instrumentTest to androidTest solves this issue. As of plugin 0.9.0, the default instrument test source root is androidTest. It appears the retaining the original name, and configuring the plugin to use the original name, caused these issues.
Upvotes: 1