Android Espresso: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
Android Espresso: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
对于我正在制作的应用程序,我添加了以下 UI 测试代码:
@LargeTest
@RunWith(AndroidJUnit4::class)
class MainActivityTest {
@Rule
@JvmField
var mActivityTestRule = ActivityTestRule(MainActivity::class.java)
@Test
fun uitest_dialogIsShown() {
onView(withId(R.id.floatingActionButton)).perform(click())
onView(withText("Please input an appropriate span count value between 1 and 100:"))
.inRoot(isDialog())
.check(matches(isDisplayed()))
}
}
每当我 运行 UI 测试时,我都会得到以下异常:
2021-11-04 19:47:13.298 6457-6496/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 6457
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~1cBxUPGvZ9-st1nQ3fjOvg==/com.realtomjoney.pyxlmoose.test-VyOwXpNZ2XUs63sLUMZveQ==/base.apk", zip file "/data/app/~~U_0CC4jTsCAqP3A1qVYV1A==/com.realtomjoney.pyxlmoose-Byn_NDW0yN-7_fOcrgQO-w==/base.apk"],nativeLibraryDirectories=[/data/app/~~1cBxUPGvZ9-st1nQ3fjOvg==/com.realtomjoney.pyxlmoose.test-VyOwXpNZ2XUs63sLUMZveQ==/lib/x86_64, /data/app/~~U_0CC4jTsCAqP3A1qVYV1A==/com.realtomjoney.pyxlmoose-Byn_NDW0yN-7_fOcrgQO-w==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:51:18.309 6775-6798/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 6775
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~9eUxQaX7nbr79YPJlVQsFg==/com.realtomjoney.pyxlmoose.test-xuUtn0i67c_hz-GDuMVQgA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~9eUxQaX7nbr79YPJlVQsFg==/com.realtomjoney.pyxlmoose.test-xuUtn0i67c_hz-GDuMVQgA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:55:09.409 6967-7004/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 6967
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~fULPcF44NgcKCpuwKR5lHA==/com.realtomjoney.pyxlmoose.test-H-KHYRNt8ei53g5_34EiXQ==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~fULPcF44NgcKCpuwKR5lHA==/com.realtomjoney.pyxlmoose.test-H-KHYRNt8ei53g5_34EiXQ==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:56:33.028 7133-7158/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7133
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~U3fFFzguF6B6EP1xeftE0g==/com.realtomjoney.pyxlmoose.test-jPO03IuyhHjn7aSdtUYdpQ==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~U3fFFzguF6B6EP1xeftE0g==/com.realtomjoney.pyxlmoose.test-jPO03IuyhHjn7aSdtUYdpQ==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:57:33.922 7259-7312/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7259
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~5sT64He_bsmo7GYldhR4BQ==/com.realtomjoney.pyxlmoose.test-mXKCT3PwPlIYtUHydiUE8A==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~5sT64He_bsmo7GYldhR4BQ==/com.realtomjoney.pyxlmoose.test-mXKCT3PwPlIYtUHydiUE8A==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:01:22.627 7481-7507/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7481
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~HYEMhxOJHTO21YfMOmi6bA==/com.realtomjoney.pyxlmoose.test-KLb_D8__Miz7y1IKfSkouw==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~HYEMhxOJHTO21YfMOmi6bA==/com.realtomjoney.pyxlmoose.test-KLb_D8__Miz7y1IKfSkouw==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:02:11.479 7605-7654/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7605
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~A7UND5UmLOPQE0hjOCkaRw==/com.realtomjoney.pyxlmoose.test-nyh8mDQAHliAe6L78dXcGg==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~A7UND5UmLOPQE0hjOCkaRw==/com.realtomjoney.pyxlmoose.test-nyh8mDQAHliAe6L78dXcGg==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:02:55.039 7746-7795/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7746
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~Am2-9l3iwhZVI6IEM8265w==/com.realtomjoney.pyxlmoose.test-EbLdbTKao67SC-ngjoHE7Q==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~Am2-9l3iwhZVI6IEM8265w==/com.realtomjoney.pyxlmoose.test-EbLdbTKao67SC-ngjoHE7Q==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:03:05.232 7909-7935/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7909
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~YNb6zFX3JmsNu92j87X3wA==/com.realtomjoney.pyxlmoose.test-PLLDtudoh5PbZURWUPctiw==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~YNb6zFX3JmsNu92j87X3wA==/com.realtomjoney.pyxlmoose.test-PLLDtudoh5PbZURWUPctiw==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:05:48.894 8081-8130/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8081
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~mO79vJVTZ-urkDvSq_HZKw==/com.realtomjoney.pyxlmoose.test-3544Ixdu-E3E1jyP5exasA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~mO79vJVTZ-urkDvSq_HZKw==/com.realtomjoney.pyxlmoose.test-3544Ixdu-E3E1jyP5exasA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:06:08.849 8207-8259/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8207
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~aBeMLwXUbOZiJk2DykSYug==/com.realtomjoney.pyxlmoose.test-ksPhMNhyGos-lE5sQwcHzg==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~aBeMLwXUbOZiJk2DykSYug==/com.realtomjoney.pyxlmoose.test-ksPhMNhyGos-lE5sQwcHzg==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:06:20.193 8364-8388/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8364
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~yo63aoWQGLjkXWlqj5syfw==/com.realtomjoney.pyxlmoose.test-vuXZhbEhmMInj4ztj0s-ug==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~yo63aoWQGLjkXWlqj5syfw==/com.realtomjoney.pyxlmoose.test-vuXZhbEhmMInj4ztj0s-ug==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:06:46.580 8482-8521/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8482
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~U2Qrw4_AcDHcRwJ93BT0Wg==/com.realtomjoney.pyxlmoose.test-Ib-zMWEdygJL0xI3M-WgkA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~U2Qrw4_AcDHcRwJ93BT0Wg==/com.realtomjoney.pyxlmoose.test-Ib-zMWEdygJL0xI3M-WgkA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:19:59.251 8759-8803/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8759
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~K4KgUJ_-JECPlDxPG_Djug==/com.realtomjoney.pyxlmoose.test-XUhqM1pFjOLvLBkELB9LNA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~K4KgUJ_-JECPlDxPG_Djug==/com.realtomjoney.pyxlmoose.test-XUhqM1pFjOLvLBkELB9LNA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:30:32.493 9077-9122/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 9077
java.lang.NoClassDefFoundError: Failed resolution of: ...
不幸的是,我试图查看其他人的问题并且提供的解决方案没有帮助 - 如果我能解决这个问题就太好了,这样我就可以为我的应用程序进行 UI 测试。
这是我的 build.gradle 文件:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
testOptions {
unitTests.includeAndroidResources = true
}
defaultConfig {
applicationId "com.realtomjoney.pyxlmoose"
minSdk 27
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.test:core-ktx:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0-alpha03'
implementation 'com.google.android.material:material:1.5.0-alpha05'
androidTestImplementation 'androidx.test:core:1.4.0'
androidTestImplementation "com.android.support:support-annotations:28.0.0"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
testImplementation 'androidx.test:core-ktx:1.4.0'
testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'androidx.test.ext:truth:1.4.0'
testImplementation 'com.google.truth:truth:1.0'
testImplementation 'org.mockito:mockito-core:3.3.3'
androidTestImplementation 'androidx.test:rules:1.4.1-alpha03'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:truth:1.4.0'
androidTestImplementation 'com.google.truth:truth:1.0'
debugImplementation "androidx.test:core:1.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
我不知道是什么导致了这个问题。
如果有人能提供帮助那就太好了!
(如果这个问题写得不好请告诉我。)
Espresso 不是单元测试,您可能缺少依赖项:
testImplementation "androidx.test:monitor:1.4.0"
我通过删除 build.gradle
文件中的以下行解决了这个问题:
implementation 'androidx.test:core-ktx:1.4.0'
对于我正在制作的应用程序,我添加了以下 UI 测试代码:
@LargeTest
@RunWith(AndroidJUnit4::class)
class MainActivityTest {
@Rule
@JvmField
var mActivityTestRule = ActivityTestRule(MainActivity::class.java)
@Test
fun uitest_dialogIsShown() {
onView(withId(R.id.floatingActionButton)).perform(click())
onView(withText("Please input an appropriate span count value between 1 and 100:"))
.inRoot(isDialog())
.check(matches(isDisplayed()))
}
}
每当我 运行 UI 测试时,我都会得到以下异常:
2021-11-04 19:47:13.298 6457-6496/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 6457
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~1cBxUPGvZ9-st1nQ3fjOvg==/com.realtomjoney.pyxlmoose.test-VyOwXpNZ2XUs63sLUMZveQ==/base.apk", zip file "/data/app/~~U_0CC4jTsCAqP3A1qVYV1A==/com.realtomjoney.pyxlmoose-Byn_NDW0yN-7_fOcrgQO-w==/base.apk"],nativeLibraryDirectories=[/data/app/~~1cBxUPGvZ9-st1nQ3fjOvg==/com.realtomjoney.pyxlmoose.test-VyOwXpNZ2XUs63sLUMZveQ==/lib/x86_64, /data/app/~~U_0CC4jTsCAqP3A1qVYV1A==/com.realtomjoney.pyxlmoose-Byn_NDW0yN-7_fOcrgQO-w==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:51:18.309 6775-6798/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 6775
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~9eUxQaX7nbr79YPJlVQsFg==/com.realtomjoney.pyxlmoose.test-xuUtn0i67c_hz-GDuMVQgA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~9eUxQaX7nbr79YPJlVQsFg==/com.realtomjoney.pyxlmoose.test-xuUtn0i67c_hz-GDuMVQgA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:55:09.409 6967-7004/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 6967
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~fULPcF44NgcKCpuwKR5lHA==/com.realtomjoney.pyxlmoose.test-H-KHYRNt8ei53g5_34EiXQ==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~fULPcF44NgcKCpuwKR5lHA==/com.realtomjoney.pyxlmoose.test-H-KHYRNt8ei53g5_34EiXQ==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:56:33.028 7133-7158/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7133
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~U3fFFzguF6B6EP1xeftE0g==/com.realtomjoney.pyxlmoose.test-jPO03IuyhHjn7aSdtUYdpQ==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~U3fFFzguF6B6EP1xeftE0g==/com.realtomjoney.pyxlmoose.test-jPO03IuyhHjn7aSdtUYdpQ==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 19:57:33.922 7259-7312/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7259
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~5sT64He_bsmo7GYldhR4BQ==/com.realtomjoney.pyxlmoose.test-mXKCT3PwPlIYtUHydiUE8A==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~5sT64He_bsmo7GYldhR4BQ==/com.realtomjoney.pyxlmoose.test-mXKCT3PwPlIYtUHydiUE8A==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:01:22.627 7481-7507/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7481
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~HYEMhxOJHTO21YfMOmi6bA==/com.realtomjoney.pyxlmoose.test-KLb_D8__Miz7y1IKfSkouw==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~HYEMhxOJHTO21YfMOmi6bA==/com.realtomjoney.pyxlmoose.test-KLb_D8__Miz7y1IKfSkouw==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:02:11.479 7605-7654/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7605
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~A7UND5UmLOPQE0hjOCkaRw==/com.realtomjoney.pyxlmoose.test-nyh8mDQAHliAe6L78dXcGg==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~A7UND5UmLOPQE0hjOCkaRw==/com.realtomjoney.pyxlmoose.test-nyh8mDQAHliAe6L78dXcGg==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:02:55.039 7746-7795/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7746
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~Am2-9l3iwhZVI6IEM8265w==/com.realtomjoney.pyxlmoose.test-EbLdbTKao67SC-ngjoHE7Q==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~Am2-9l3iwhZVI6IEM8265w==/com.realtomjoney.pyxlmoose.test-EbLdbTKao67SC-ngjoHE7Q==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:03:05.232 7909-7935/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 7909
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~YNb6zFX3JmsNu92j87X3wA==/com.realtomjoney.pyxlmoose.test-PLLDtudoh5PbZURWUPctiw==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~YNb6zFX3JmsNu92j87X3wA==/com.realtomjoney.pyxlmoose.test-PLLDtudoh5PbZURWUPctiw==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:05:48.894 8081-8130/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8081
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~mO79vJVTZ-urkDvSq_HZKw==/com.realtomjoney.pyxlmoose.test-3544Ixdu-E3E1jyP5exasA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~mO79vJVTZ-urkDvSq_HZKw==/com.realtomjoney.pyxlmoose.test-3544Ixdu-E3E1jyP5exasA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:06:08.849 8207-8259/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8207
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~aBeMLwXUbOZiJk2DykSYug==/com.realtomjoney.pyxlmoose.test-ksPhMNhyGos-lE5sQwcHzg==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~aBeMLwXUbOZiJk2DykSYug==/com.realtomjoney.pyxlmoose.test-ksPhMNhyGos-lE5sQwcHzg==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:06:20.193 8364-8388/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8364
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~yo63aoWQGLjkXWlqj5syfw==/com.realtomjoney.pyxlmoose.test-vuXZhbEhmMInj4ztj0s-ug==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~yo63aoWQGLjkXWlqj5syfw==/com.realtomjoney.pyxlmoose.test-vuXZhbEhmMInj4ztj0s-ug==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:06:46.580 8482-8521/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8482
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~U2Qrw4_AcDHcRwJ93BT0Wg==/com.realtomjoney.pyxlmoose.test-Ib-zMWEdygJL0xI3M-WgkA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~U2Qrw4_AcDHcRwJ93BT0Wg==/com.realtomjoney.pyxlmoose.test-Ib-zMWEdygJL0xI3M-WgkA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:19:59.251 8759-8803/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 8759
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.io.FileTestStorage" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~~K4KgUJ_-JECPlDxPG_Djug==/com.realtomjoney.pyxlmoose.test-XUhqM1pFjOLvLBkELB9LNA==/base.apk", zip file "/data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~K4KgUJ_-JECPlDxPG_Djug==/com.realtomjoney.pyxlmoose.test-XUhqM1pFjOLvLBkELB9LNA==/lib/x86_64, /data/app/~~OOAovBMGWN3BM4FoM0V0uw==/com.realtomjoney.pyxlmoose-ZKeHj2YKiPi9DbleSh6xqQ==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:636)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:433)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2248)
2021-11-04 20:30:32.493 9077-9122/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.runner.AndroidJUnitRunner
Process: com.realtomjoney.pyxlmoose, PID: 9077
java.lang.NoClassDefFoundError: Failed resolution of: ...
不幸的是,我试图查看其他人的问题并且提供的解决方案没有帮助 - 如果我能解决这个问题就太好了,这样我就可以为我的应用程序进行 UI 测试。
这是我的 build.gradle 文件:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
testOptions {
unitTests.includeAndroidResources = true
}
defaultConfig {
applicationId "com.realtomjoney.pyxlmoose"
minSdk 27
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.test:core-ktx:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0-alpha03'
implementation 'com.google.android.material:material:1.5.0-alpha05'
androidTestImplementation 'androidx.test:core:1.4.0'
androidTestImplementation "com.android.support:support-annotations:28.0.0"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
testImplementation 'androidx.test:core-ktx:1.4.0'
testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'androidx.test.ext:truth:1.4.0'
testImplementation 'com.google.truth:truth:1.0'
testImplementation 'org.mockito:mockito-core:3.3.3'
androidTestImplementation 'androidx.test:rules:1.4.1-alpha03'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:truth:1.4.0'
androidTestImplementation 'com.google.truth:truth:1.0'
debugImplementation "androidx.test:core:1.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
我不知道是什么导致了这个问题。
如果有人能提供帮助那就太好了!
(如果这个问题写得不好请告诉我。)
Espresso 不是单元测试,您可能缺少依赖项:
testImplementation "androidx.test:monitor:1.4.0"
我通过删除 build.gradle
文件中的以下行解决了这个问题:
implementation 'androidx.test:core-ktx:1.4.0'