运行测试代码出现initializationError
当运行测试代码的时候遇到这个
java.lang.Exception: Attempted to use AndroidJUnit4 with standard JUnit runner and delegate runner 'org.robolectric.RobolectricTestRunner'could not be loaded. Check your build configuration.
说明你包导入错了,将
import android.support.test.runner.AndroidJUnit4;
改成import androidx.test.ext.junit.runners.AndroidJUnit4;
再运行一次,就成功啦。