【问题标题】:Google Map not loading specifically in Android Lollipop and Marshmallow Google map v2Google Map 未在 Android Lollipop 和 Marshmallow Google map v2 中专门加载
【发布时间】: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


    【解决方案1】:
    I was having same issue once I was working in an App. 
    try to resume map in OnResume().
    
    `override fun onResume() {
            super.onResume()
            map.let{
                it.onResume()
            }
        }` 
    

    【讨论】:

    • 你拯救了我的一天。小小的愚蠢的错误毁了我的工作。谢谢队友:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-15
    • 1970-01-01
    • 2014-07-18
    • 2013-07-18
    • 1970-01-01
    相关资源
    最近更新 更多