admin管理员组文章数量:1333632
I've recently switched from com.google.android.gms:play-services-maps:18.0.2
to com.google.android.gms:play-services-maps:19.0.0
but I'm getting crashes in my app while adding polygons to the googleMap.
With older version it is working fine, but new one throws ClassCastException
java.lang.ClassCastException: com.squareup.moshi.LinkedHashTreeMap cannot be cast to android.os.Parcelable
at com.google.android.gmsmon.internal.safeparcel.SafeParcelWriter.writeTypedList(com.google.android.gms:play-services-basement@@18.3.0:5)
at com.google.android.gms.maps.model.PolygonOptions.writeToParcel(com.google.android.gms:play-services-maps@@19.0.0:2)
at com.google.android.gms.internal.maps.zzc.zze(com.google.android.gms:play-services-maps@@19.0.0:3)
at com.google.android.gms.maps.internal.zzg.addPolygon(com.google.android.gms:play-services-maps@@19.0.0:2)
at com.google.android.gms.maps.GoogleMap.addPolygon(com.google.android.gms:play-services-maps@@19.0.0:2)
Is there any major change that has occured in PolygonOptions
? Because I can't find anything there.
PolygonOptions.writeTypedList is used only for points
and stroke pattern
.
This is function I'm using to add polygons:
private fun addPolygon(polygonData: Pair<*, PolygonOptions>) {
googleMap?.addPolygon(polygonData.second)?.let {
it.tag = polygonData.first
polygons.add(it)
}
}
Inside points there is just List<LatLng>
with values. But
19.0.0:
[{latitude=32.4016388, longitude=22.6369665}, {latitude=32.2016388, longitude=22.6369665}]
18.0.2:
[lat/lng: (32.4016388,22.6369665), lat/lng: (32.2016388,22.6369665)]
This is main difference I see. Its both for holes
list and points
list
I've tried to manually create PolygonOptionsAdapter
utilizing @FromJson
and @ToJson
but it is returning some obfuscated names for variables.
Instead of points there is field called zza
, then you have zzb
, zzc
.
I don't think I can manually create adapter to deserialize and serialize this json from com.google.android.gms.maps.model
since its decompiled as class file.
I've recently switched from com.google.android.gms:play-services-maps:18.0.2
to com.google.android.gms:play-services-maps:19.0.0
but I'm getting crashes in my app while adding polygons to the googleMap.
With older version it is working fine, but new one throws ClassCastException
java.lang.ClassCastException: com.squareup.moshi.LinkedHashTreeMap cannot be cast to android.os.Parcelable
at com.google.android.gmsmon.internal.safeparcel.SafeParcelWriter.writeTypedList(com.google.android.gms:play-services-basement@@18.3.0:5)
at com.google.android.gms.maps.model.PolygonOptions.writeToParcel(com.google.android.gms:play-services-maps@@19.0.0:2)
at com.google.android.gms.internal.maps.zzc.zze(com.google.android.gms:play-services-maps@@19.0.0:3)
at com.google.android.gms.maps.internal.zzg.addPolygon(com.google.android.gms:play-services-maps@@19.0.0:2)
at com.google.android.gms.maps.GoogleMap.addPolygon(com.google.android.gms:play-services-maps@@19.0.0:2)
Is there any major change that has occured in PolygonOptions
? Because I can't find anything there.
PolygonOptions.writeTypedList is used only for points
and stroke pattern
.
This is function I'm using to add polygons:
private fun addPolygon(polygonData: Pair<*, PolygonOptions>) {
googleMap?.addPolygon(polygonData.second)?.let {
it.tag = polygonData.first
polygons.add(it)
}
}
Inside points there is just List<LatLng>
with values. But
19.0.0:
[{latitude=32.4016388, longitude=22.6369665}, {latitude=32.2016388, longitude=22.6369665}]
18.0.2:
[lat/lng: (32.4016388,22.6369665), lat/lng: (32.2016388,22.6369665)]
This is main difference I see. Its both for holes
list and points
list
I've tried to manually create PolygonOptionsAdapter
utilizing @FromJson
and @ToJson
but it is returning some obfuscated names for variables.
Instead of points there is field called zza
, then you have zzb
, zzc
.
I don't think I can manually create adapter to deserialize and serialize this json from com.google.android.gms.maps.model
since its decompiled as class file.
1 Answer
Reset to default 0I'd suspect, the model class being used for Moshi's ORM is not being properly annotated, because else it should indeed be List<LatLng>
or ArrayList<LatLng>
... the other option would be making it parcel-able, which is probably not required, when returning the expected data-type with ORM. That *
in the signature should be ArrayList<LatLng>
...because with *
this fails one call later, when passing an unexpected argument.
本文标签: androidGoogleMapServices Adding Polygon to the map causes exception in version 1900Stack Overflow
版权声明:本文标题:android - GoogleMapServices: Adding Polygon to the map causes exception in version 19.0.0 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742357563a2459723.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论