Robolectric java.lang.RuntimeException:java.lang.reflect.InvocationTargetException

时间:2014-11-02 07:44:47

标签: android junit robolectric android-testing

我试图在我的项目上运行roboelectric(有多个Android库项目),当我尝试使用简单的字符串检查运行测试项目时,我不断收到此错误。

  

了java.lang.RuntimeException:   java.lang.reflect.InvocationTargetException at   org.robolectric.bytecode.RobolectricInternals.newInstanceOf(RobolectricInternals.java:33)     在org.robolectric.Robolectric.newInstanceOf(Robolectric.java:348)     在org.robolectric.Robolectric.newInstanceOf(Robolectric.java:355)     在   org.robolectric.shadows.ShadowApplication.registerBroadcastReceivers(ShadowApplication.java:121)     在   org.robolectric.shadows.ShadowApplication.bind(ShadowApplication.java:110)     在   org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:136)     在   org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:430)     在   org.robolectric.RobolectricTestRunner $ 2.evaluate(RobolectricTestRunner.java:236)     在org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)at   org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)     在   org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)     在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:231)at   org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:60)at   org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)at at   org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:50)at   org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:222)at at   org.robolectric.RobolectricTestRunner $ 1.evaluate(RobolectricTestRunner.java:177)     在org.junit.runners.ParentRunner.run(ParentRunner.java:300)at   org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)     在   org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)     在   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)     在   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)     在   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)     在   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)   引起:java.lang.reflect.InvocationTargetException at   sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)     在   org.robolectric.bytecode.RobolectricInternals.newInstanceOf(RobolectricInternals.java:25)

1 个答案:

答案 0 :(得分:0)

java.lang.NoSuchMethodError:android.util.Log.secD(Ljava / lang / String; Ljava / lang / String;)是你得到的错误。

好像你的库(依赖)版本不匹配?