在 Android VM(模拟器 4.1)上检测后,尝试使用 Mockito.spy 对活动进行部分模拟。这是我得到的错误
java.lang.VirtualMachineError
at dalvik.system.DexFile.defineClass(Native Method)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
at dalvik.system.DexFile.loadClass(DexFile.java:196)
at dalvik.system.DexClassLoader.findClass(DexClassLoader.java:226)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at com.google.dexmaker.stock.ProxyBuilder.loadClass(ProxyBuilder.java:272)
at com.google.dexmaker.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:254)
at com.google.dexmaker.mockito.DexmakerMockMaker.createMock(DexmakerMockMaker.java:54)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:49)
at org.mockito.Mockito.spy(Mockito.java:1324)
at com.company.droid.helper.ActivitySandbox.setupActivity(ActivitySandbox.java:21)
at com.company.droid.ui.fragment.signup.SignupFragmentTest.setUp(SignupFragmentTest.java:50)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
我尝试过更改虚拟机、Mockito 版本、Dexmaker 版本,但似乎没有任何效果。有任何想法吗?