【问题标题】:How solve Google Play Store is missing warning to show google map in Flutter如何解决 Google Play 商店缺少在 Flutter 中显示谷歌地图的警告
【发布时间】:2020-07-05 01:19:49
【问题描述】:
W/GooglePlayServicesUtil( 4892): Google Play Store is missing.

此警告阻止 google 地图在 genymotion 设备中显示。

这是 android 9 在 genymotion 中地图的输出:

我该如何解决这个问题? 已完成并添加了为 android 和 ios 启用 google map sdk 和获取 ApiKey 所需的所有步骤。 这是地图屏幕的代码。

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class MapScreen extends StatefulWidget {
  @override
  _MapScreenState createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
  static final CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(title:Text("map") ,),
        body:Container(
          width: 400,
          height: 400,
          child:  GoogleMap(
            mapType: MapType.hybrid,
            initialCameraPosition: _kGooglePlex,
            onMapCreated: (GoogleMapController controller) {
//        _controller.complete(controller);
            },
          ),
        ));
  }
}

【问题讨论】:

  • 使用带有 google play 服务的实际设备或 Android Studio 模拟器。看起来这个 genymotion 模拟器没有安装 google play 服务。
  • 感谢您的回复,但我的真实设备是 api 19,这个谷歌地图至少需要 api 20。我该如何安装服务?你能给我一个链接吗?

标签: android-studio google-maps flutter genymotion


【解决方案1】:

最后我解决了这个问题,我们不需要安装任何东西。 我们只需要在模拟器中启用 GPS(右上角)。

在启用 GPS 之前,我遇到了以下错误

W/GooglePlayServicesUtil(2239):com.example.weather 需要 Google Play 商店,但它缺失。 I/颤振(2239):纬度:0.0,经度:0.0

启用 GPS 后,它工作正常,我正在获取位置

W/GooglePlayServicesUtil(2239):com.example.weather 需要 Google Play 商店,但它缺失。 I/颤振(2239):纬度:65.9667,经度:-18.5333

【讨论】:

  • 看来你还有requires the Google Play Store, but it is missing的问题。你确定它工作正常吗?
【解决方案2】:

您可以通过从 genymotion 模拟器安装 GApps 来解决该错误。它是模拟器右上角的一个图标,然后单击它。安装 GApps 后重新启动虚拟设备,现在它有 google play 服务。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-16
    • 2018-01-30
    • 2019-09-28
    • 1970-01-01
    相关资源
    最近更新 更多