Недавно я обновил мой бегун JUnit 4 с androidx.test.runner.AndroidJUnit4 до androidx.test.ext.junit.runners.AndroidJUnit4.
Когда я выполняю тест, я получаю следующую ошибку: Тест не выполнен:
Instrumentation run failed due to 'Process crashed.'
LogCat показывает эту ошибку:
java.lang.InstantiationException:
java.lang.Class<androidx.test.ext.junit.runners.AndroidJUnit4> has no zero argument constructor
Все операции импорта в тесте выполнены правильно, и я не получаю никаких ошибок в сборке.
Мой приложение выглядит так:
defaultConfig {
testInstrumentationRunner 'androidx.test.ext.junit.runners.AndroidJUnit4'
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation "androidx.test.ext:junit:1.1.0"
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'