在使用Mockito.spy对Android VM(模拟器4.1)进行检测后,尝试对活动进行部分模拟。这是我得到的错误
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版本,但似乎没有任何效果。有什么想法吗?
答案 0 :(得分:0)
似乎是Dalvik的一个错误,DexMaker没有避免这个错误。
如果需要,请参阅此错误报告并投票。 https://code.google.com/p/dexmaker/issues/detail?id=9