AndroidX Espresso InstrumentationTestRunner NoClassDefFoundError JTreeTable

时间:2019-03-28 11:56:43

标签: android-gradle android-espresso androidx android-instrumentation

自从迁移到androidx以来,出现以下错误

(term == 1)

依赖项:

03-28 12:38:31.051 12658-12697/de.epost.epostapp E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: de.epost.epostapp, PID: 12658
java.lang.NoClassDefFoundError: org.mozilla.javascript.tools.debugger.treetable.JTreeTable
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:324)
    at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:72)
    at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104)
    at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:789)
    at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:543)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:386)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)

是的

com.android.tools.build:gradle:3.2.1
gradle-4.10.3
sdk: 28

在我的调试清单文件中,添加了以下内容

android {
..
defaultConfig {
...
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...
}
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
}

可以从Android Studio IDE运行测试,但可以运行测试 从命令行使用gradle会导致错误

./ graldew clean:connectedAndroidTest不起作用

0 个答案:

没有答案