2011年6月7日 星期二

[Android] Bound mismatch: The type XXX is not a valid substitute for the bounded parameter of the type ActivityInstrumentationTestCase2

I got an error message as title at android unit test case:
Bound mismatch: The type MyActivity is not a valid substitute for the bounded parameter <T extends Activity> of the type ActivityInstrumentationTestCase2<T>

I found the solution at link of reference and extract content as below:
The problem is that the android-support-v4.jar that you are using in your test project is different from the one in your application project. Remove all of the references to android-support-v4.jar from your test project. Then go to your application project Properties->Java Build Path->Order and Export and check android-support-v4.jar to export it. Now both projects will be using the same library, and dalvik won't complain.

Reference:
http://stackoverflow.com/questions/5561353/fragmentactivity-can-not-be-tested-via-activityinstrumentationtestcase2

1 則留言:

  1. No, that does not work. Why did you assume that android-support-v4.jar is the problem here?

    回覆刪除