Vitor Santos
Vitor Santos

Reputation: 314

Android Testing: Instrumentation run failed due to 'java.lang.ClassNotFoundException'

I have 3 test classes for a particular package from my main application. My first test class is running just fine, the other 2 aren't.

When I try to run those 2 tests, I get the following error:

Instrumentation run failed due to 'java.lang.ClassNotFoundException'

I already verified:

Any guess about what the problem is?

-----//-----

Solution:

I changed the version of jUnit I was using and the tests perform as they should.

Upvotes: 6

Views: 10251

Answers (3)

Libin
Libin

Reputation: 17085

Java build path should export JUnit 4 library(checked) and Ensure you clean and rebuild the project

Upvotes: 1

ThanhHH
ThanhHH

Reputation: 6600

You need to add JUnit library to your package as following:

On Eclipse, right click on your test project, choose Properties --> Java Build Path, on Order and Export tab, please check on JUnit 4 and click OK.

After that, clean or rebuild your test project and run.

Upvotes: 11

Nipun Gogia
Nipun Gogia

Reputation: 1856

have you define your other two class in "AndroidManifest"

Upvotes: 0

Related Questions