Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 谷歌地图问题_Google Maps_Flutter - Fatal编程技术网

Google maps 谷歌地图问题

Google maps 谷歌地图问题,google-maps,flutter,Google Maps,Flutter,一个非常简单的应用程序,只有一个谷歌地图屏幕,它从Codelabs复制以下内容: @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Maps Sample App'), backgroundColor: Colors.green[700],

一个非常简单的应用程序,只有一个谷歌地图屏幕,它从Codelabs复制以下内容:

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Maps Sample App'),
          backgroundColor: Colors.green[700],
        ),
        body: GoogleMap(
          onMapCreated: _onMapCreated,
          initialCameraPosition: CameraPosition(
            target: _center,
            zoom: 11.0,
          ),
        ),
      ),
    );
  }
运行应用程序时崩溃,我得到以下堆栈:

=========================================

    *** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23c710bc +[NSException raise:format:] + 188
    3   Runner                              0x00000001050730e3 +[GMSServices checkServicePreconditions] + 182
    4   Runner                              0x000000010506ff22 +[GMSServices sharedServicesSync] + 110
    5   Runner                              0x000000010505f979 -[GMSMapView sharedInitWithServices:camera:forPlaces:] + 156
    6   Runner                              0x000000010505ede1 -[GMSMapView initWithFrame:camera:] + 123
    7   Runner                              0x000000010505ec05 +[GMSMapView mapWithFrame:camera:] + 104
    8   Runner <…>
Lost connection to device.
***第一次抛出调用堆栈:
(
0 CoreFoundation 0x00007fff23c7127e例外预处理+350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_异常_抛出+48
2 CoreFoundation 0x00007fff23c710bc+[N异常提升:格式:][188
3运行程序0x00000001050730e3+[GMS服务检查服务前提条件]+182
4运行程序0x000000010506ff22+[GMSServices SharedServiceSync]+110
5运行程序0x000000010505f979-[GMSMapView sharedInitWithServices:camera:forPlaces:+156
6运行程序0x000000010505ede1-[GMSMapView initWithFrame:camera:][123
7运行程序0x000000010505ec05+[GMSMapView mapWithFrame:camera:][104
8跑步者
与设备的连接中断。
============================================

    *** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23c710bc +[NSException raise:format:] + 188
    3   Runner                              0x00000001050730e3 +[GMSServices checkServicePreconditions] + 182
    4   Runner                              0x000000010506ff22 +[GMSServices sharedServicesSync] + 110
    5   Runner                              0x000000010505f979 -[GMSMapView sharedInitWithServices:camera:forPlaces:] + 156
    6   Runner                              0x000000010505ede1 -[GMSMapView initWithFrame:camera:] + 123
    7   Runner                              0x000000010505ec05 +[GMSMapView mapWithFrame:camera:] + 104
    8   Runner <…>
Lost connection to device.
使用的插件是:谷歌地图颤振:^0.5.11


这里发生了什么?

在AppDelegate.swift上添加代码定义API键谷歌地图

  GMSServices.provideAPIKey("YOUR_KEY")

您是否已将google地图的google_api_密钥添加到您的Flatter应用程序中?如果未添加,请遵循。是的,api已添加到AppDelegate.m,并且根据说明对info.plist进行了编辑。有趣的是,我有一个较旧的应用程序,可以追溯到大约一年前,它可以与google地图一起正常工作,但我无法创建任何新的应用程序。