I just recently found solution for this issue that was posted by devdanke:
"As of 11-July-2010 and Android 2.1, the work around I use is to segregate tests into different classes. Any test(s) that don't call any Android APIs go into their own classes. For each of these classes, I remove the reference to Android in their Run Configurations, Classpath tab."
The problem with having it configured class by class is then is not possible to run all tests in project. Better approach is creating 2 test projects with different sets of libraries.
Standard Android JUnit Test project can be created following link, and sample test class looks like:
import android.test.AndroidTestCase;
public class ConverterTest extends AndroidTestCase {
public void testConvert() {
assertEquals("one", "one");
}
}
Then JUnit Test project can be converted from Android JUnit Test project by removing Android Library from project build path, and adding JRE System Library, and JUnit 3 library, and sample test class looks like:
import junit.framework.TestCase;
public class ConverterTest extends TestCase{
public void testConvert() {
assertEquals("one", "one");
}
}