我刚刚在我们的 Android 项目中将 Mockito 从 3.10.0 升级到 3.11.0,现在,运行仪器测试崩溃,但出现以下异常。有什么建议吗?
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:84)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy10.isTypeMockable(Unknown Source)
at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:33)
at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:250)
at org.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:232)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:83)
at org.mockito.Mockito.mock(Mockito.java:1954)
at org.mockito.Mockito.mock(Mockito.java:1865)
at com.oslonokkel.ui.FragmentTestRunner.createNavController(FragmentTestRunner.kt:127)
at com.oslonokkel.ui.FragmentTestRunner.access$createNavController(FragmentTestRunner.kt:44)
at com.oslonokkel.ui.FragmentTestRunner$runTest$1.invokeSuspend(FragmentTestRunner.kt:58)
at com.oslonokkel.ui.FragmentTestRunner$runTest$1.invoke(Unknown Source:8)
at com.oslonokkel.ui.FragmentTestRunner$runTest$1.invoke(Unknown Source:4)
at kotlinx.coroutines.test.TestBuildersKt$runBlockingTest$deferred$1.invokeSuspend(TestBuilders.kt:50)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.test.TestCoroutineDispatcher.dispatch(TestCoroutineDispatcher.kt:50)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:332)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.async(Builders.common.kt:91)
at kotlinx.coroutines.BuildersKt.async(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.async$default(Builders.common.kt:82)
at kotlinx.coroutines.BuildersKt.async$default(Unknown Source:1)
at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(TestBuilders.kt:49)
at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(TestBuilders.kt:80)
at com.oslonokkel.ui.FragmentTestRunner.runTest(FragmentTestRunner.kt:55)
at com.oslonokkel.ui.fragments.FeedbackFragmentTest.allFieldsEmpty(FeedbackFragmentTest.kt:41)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
at com.oslonokkel.utils.RetryTestRule$statement$1.evaluate(RetryTestRule.kt:27)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@f4afab0
at org.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:57)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:65)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:50)
at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:26)
at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:20)
at org.mockito.internal.configuration.plugins.Plugins.getMockMaker(Plugins.java:36)
at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:28)
... 59 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at org.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:52)
... 65 more
Caused by: java.lang.IllegalStateException: Failed to resolve the class file version of the current VM: This JVM's version string does not seem to be valid: 0
at net.bytebuddy.ClassFileVersion$VersionLocator$Unresolved.resolve(ClassFileVersion.java:558)
at net.bytebuddy.ClassFileVersion.ofThisVm(ClassFileVersion.java:276)
at net.bytebuddy.description.method.ParameterList$ForLoadedExecutable.of(ParameterList.java:205)
at net.bytebuddy.description.method.MethodDescription$ForLoadedMethod.getParameters(MethodDescription.java:1179)
at net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.compile(TargetMethodAnnotationDrivenBinder.java:82)
at net.bytebuddy.implementation.MethodDelegation$ImplementationDelegate$ForStaticMethod.of(MethodDelegation.java:948)
at net.bytebuddy.implementation.MethodDelegation$WithCustomProperties.to(MethodDelegation.java:1512)
at net.bytebuddy.implementation.MethodDelegation$WithCustomProperties.to(MethodDelegation.java:1493)
at net.bytebuddy.implementation.MethodDelegation.to(MethodDelegation.java:271)
at org.mockito.internal.creation.bytebuddy.SubclassBytecodeGenerator.<init>(SubclassBytecodeGenerator.java:63)
at org.mockito.internal.creation.bytebuddy.SubclassBytecodeGenerator.<init>(SubclassBytecodeGenerator.java:73)
at org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.<init>(SubclassByteBuddyMockMaker.java:37)
at org.mockito.android.internal.creation.AndroidByteBuddyMockMaker.<init>(AndroidByteBuddyMockMaker.java:22)
... 68 more