My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 21888: r15 library projects cannot be tested (Class ref in pre-verified class resolved to unexpected implementation.)
16 people starred this issue and may be notified of changes. Back to list
 
Reported by jason.po...@gmail.com, Nov 15, 2011
A standard arrangement of 3 projects:

1. Library project
2. Sample project which uses the library project
3. Test project which tests the sample

Leads to the following error:

Class ref in pre-verified class resolved to unexpected implementation.

SETUP:

Attached are 3 projects reproducing the problem.  These are Eclipse projects and to reproduce follow these steps:

1. Import the projects into Eclipse
2. Ensure BOTH the Sample project and the Test project are referencing the Library project as an Android Library project
3. Ensure the Test project is referencing the Sample project as an Eclipse Project Reference

From the command line:

In the Test project, run the following ANT command:

ant custom-test

The "custom-test" task simply does the following:

1. Calls "clean" on all projects
2. Calls uninstall, debug, installd and test

This consistently results in:

[exec] com.buildtest.test.BuildTestJUnitTest:INSTRUMENTATION_RESULT: shortMsg=java.lang.IllegalAccessError
[exec] INSTRUMENTATION_RESULT: longMsg=java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
[exec] INSTRUMENTATION_CODE: 0

ANALYSIS:

It appears that the library project is build multiple times, once for the Sample project and once for the Test project.  When the Test project is build it therefore uses a different version of the compiled classes from the library project.



STEPS TO REPRODUCE:
1.
2.
3.

EXPECTED RESULTS:

OBSERVED RESULTS:

ADDITIONAL INFORMATION:
Attach sample project, etc.
If possible, try to reproduce using ApiDemos.
If the problem is happening in the emulator, consider attaching the output
of "adb bugreport"

buildtest-sample.zip
177 KB   Download
Nov 16, 2011
Project Member #1 r...@android.com
(No comment was entered for this change.)
Status: Unassigned
Owner: x...@android.com
Labels: Subcomponent-Tools-adt-builders
Dec 21, 2011
#2 rbur...@gmail.com
same problem with r16, I can do one of 2 things

1. remove the android reference to the library in the test project (so in project-test/project.properties) => results in compiler error if you want to call code from the library (you can hack eclipse to get this working by exporting library projects in the main project)
2. leave it in as described in the bug description => error with unexpected implementation

this is just broken. I cannot believe that noone got this to work in ant
Apr 23, 2012
Project Member #3 x...@android.com
(No comment was entered for this change.)
Status: FutureRelease
Labels: Target-r20
Jul 11, 2012
Project Member #4 x...@android.com
(No comment was entered for this change.)
Status: Released
Aug 14, 2012
#5 bali.par...@gmail.com
I am running the ADT20 and still getting the exact same error (below). Am I missing something?

android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:INSTRUMENTATION_RESULT: shortMsg=java.lang.IllegalAccessError
INSTRUMENTATION_RESULT: longMsg=java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
INSTRUMENTATION_CODE: 0
Tests failed.

Sign in to add a comment

Powered by Google Project Hosting