【发布时间】:2019-09-02 15:40:54
【问题描述】:
我正在尝试使用集群加载谷歌地图,在 android 5、6 API 级别 21、22 和 23 上,我遇到了谷歌地图从不加载的问题。在其他平台上它的工作正常,即牛轧糖、奥利奥派。
我已经仔细检查了 google api 控制台并更改了 api 密钥,运行时权限没有问题事实上我也评论了这一行。 //应用插件:'com.google.gms.google-services'和类路径。
除此之外不打印任何日志 I/Google Maps Android API:Google Play 服务客户端版本:12451000 I/Google Maps Android API:Google Play 服务包版本:17194018
override fun onMapReady(map: GoogleMap?) {
googleMap = map
try {
//parsing dark map style to map view
val success =
map.setMapStyle(MapStyleOptions.loadRawResourceStyle(context, R.raw.map_style_dark))
if (!success) {
//parsing failed
Log.e(TAG, "Style parsing failed.")
}
} catch (e: Resources.NotFoundException) {
//if style not found
Log.e(TAG, "Can't find style. Error: ", e)
}
}
【问题讨论】:
标签: android google-maps android-6.0-marshmallow