avjinder/Minimal-Todo

cannot resolve symbol libcore

Opened this issue · 2 comments

When I mocked the JsonObject, I find an error cannot resolve symbol libcore.

Hello, could you explain more about the problem?

Hello, could you explain more about the problem?

I got this error when I try to run unit test. But finally I built my unit test by modified the build.gradle file.

defaultConfig {
    testInstrumentationRunner = 'android.support.test.runner.AndroidJUnitRunner'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.json:json:20140107'
}

I also learn When to use instrumented tests and when to use local unit tests. In this project, the class JSONObject is part of the android SDK. That means that is not available for unit testing by default. Maybe it is better to use instrumented tests.