更新时间:2023-11-17 08:36:52
在您模块中的 build.gradle
:
apply plugin: 'com.android.application'
android {
...
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation "org.robolectric:robolectric:4.2.1"
...
}
您的测试类必须包含以下内容:
Your test class has to contain the following:
@RunWith(RobolectricTestRunner.class)
public class LocationTest {
...
}
应该就是这样.