How to make simple vanilla junit tests in android? Getting an error on execution

I want to run a simple junit test on java classes that do not use any Android related resources. However; when I try to run the junit test in eclipse, I get the following error.

guarantee(_name_index != 0 && _signature_index != 0) 
    failed: bad constant pool index for fieldDescriptor

Im using junit-4.8.2.jar as a library resource.

What am I doing wrong. Ultimately, I will set up a separate test project for testing Android resources.

thank

+5
source share
3 answers

I resolved this issue by removing the existing JUnit startup configuration and instead running the Android JUnit startup configuration.

Eclipse , Eclipse Android- JUnit. .

+2

JUnit 4 JUnit 3 ( android) . , Dalvik, JavaSE . .

+1

I agree, when you just want to test methods outside of the Android application as a whole (which is very desirable), its dumb to use dalvik. Perhaps just creating a separate java project is the best options and importing the classes you want to test. This seems to work.

0
source

All Articles