Robolectric 2.3& android注释

时间:2014-12-08 11:14:38

标签: robolectric android-annotations

为了在android studio中使用robolectric之后出现多种问题,我在创建活动时遇到错误。

所以我使用以下代码

@Before
public void setUp() throws Exception {
    mapActivity = Robolectric.buildActivity(MapActivity_.class).create().visible().get();
}

我决定建立一个带注释的活动,但我会遇到这个问题(如果我建立"正常"活动,同样的问题)

WARNING: No manifest file found at /path/to/AndroidManifest.xml.Falling back to the Android OS resources only.
To remove this warning, annotate your test class with @Config(manifest=Config.NONE).
WARNING: no system properties value for ro.build.date.utc

org.fest.reflect.exception.ReflectionError: Unable to create a new object from the enclosed constructor
    at org.fest.reflect.constructor.Invoker.newInstance(Invoker.java:82)
    at org.robolectric.util.ActivityController.<init>(ActivityController.java:41)
    at org.robolectric.Robolectric.buildActivity(Robolectric.java:1376)
    at com.ecab.MapActivityTest.setUp(MapActivityTest.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    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.RunBefores.evaluate(RunBefores.java:24)
    at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:250)
    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.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 30
Exception Details:
  Location:
    com/google/android/gms/location/LocationRequest.setExpirationTime(J)Lcom/google/android/gms/location/LocationRequest; @7: ifeq
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: 2ab4 010c c100 0299 0017 2ab4 010c c000

你知道我怎么解决这个问题?

THX

0 个答案:

没有答案