Android 机器人分子和gms/maps 更新:

Android 机器人分子和gms/maps 更新:,android,robolectric,Android,Robolectric,问题似乎在于GooglePlayServices字节码没有stackmap框架。不确定这是否重要,但我正在使用JDK 8有报道称,通过使用Google PlayServices的后台解决方案,但是作为一种解决方案(至少现在),我在Run->editConfigurations下为JUnit的默认VM选项添加了-noverify标志,现在我的测试通过了。如果有人有更清洁的解决方案,我仍在寻找。 在更新了一个有点旧的项目之后,我正在尝试重新运行一些测试(当我上次使用它时,我使用的是AndroidS

问题似乎在于GooglePlayServices字节码没有stackmap框架。不确定这是否重要,但我正在使用JDK 8有报道称,通过使用Google PlayServices的后台解决方案,但是作为一种解决方案(至少现在),我在Run->editConfigurations下为JUnit的默认VM选项添加了
-noverify
标志,现在我的测试通过了。如果有人有更清洁的解决方案,我仍在寻找。


在更新了一个有点旧的项目之后,我正在尝试重新运行一些测试(当我上次使用它时,我使用的是AndroidStudio 1.0x,现在我使用的是1.5.1)

我已经迁移到Robolectric 3.0,但是我在一些使用gms/maps的测试中遇到了一些问题。下面是我得到的堆栈跟踪的一个示例:

java.lang.VerifyError: Expecting a stackmap frame at branch target 15
Exception Details:
  Location:
    com/google/android/gms/maps/model/LatLng.writeToParcel(Landroid/os/Parcel;I)V @3: ifeq
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: b800 1b99 000c 2a2b 1cb8 001f a700 092a
    0000010: 2b1c b800 1eb1                         

    at com.gmail.npnster.ourlatitude.MapMarker.getLatLng(MapMarker.java:143)
我的build.gradle文件中有以下内容

testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.robolectric:shadows-maps:3.0'
testCompile 'org.robolectric:shadows-play-services:3.0'
测试类具有以下注释:

@Config(constants = BuildConfig.class, shadows = {ShadowGooglePlayServicesUtil.class} )
@RunWith(RobolectricGradleTestRunner.class)
失败发生的那一行是下面方法中的return语句

public LatLng getLatLng() {
    return new LatLng(mMarker.getLatitude(), mMarker.getLongitude());
}

这在我使用Robolectric 2.4时起了作用,但我不确定这是我如何设置Robolectric的问题,还是我有其他问题。应用程序本身似乎运行良好。

你能将
sdk=21
添加到你的
@Config
中吗?谢谢,我会试一试。。。目前由于其他原因而中断:)您能否将
sdk=21
添加到您的
@Config
?谢谢,我将尝试一下。。。目前由于其他原因而中断:)