Проблема с запуском приложения Maps на ключе flutter-API не обнаружена - PullRequest
0 голосов
/ 07 мая 2020

** Итак, у меня возникла проблема с поиском решения этой проблемы.

Я пытаюсь запустить простое приложение карты, и все, что я вижу, это пустой экран.

Проведя несколько часов в Интернете, пытаясь найти похожий пост, мне не удалось его исправить.

SDK карты включен для android, а также для IOS.

Maps_Enabled_Picture

это часть манифеста **

<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="integrativeUI2020"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">



        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
          <meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="AIzaSyDkKQaxxxxlIhmp1nmQrVQHnE"/>

код

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  GoogleMapController mapController;

  final LatLng _center = const LatLng(45.521563, -122.677433);

  void _onMapCreated(GoogleMapController controller) {
    mapController = controller;
  }

  @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,
          ),
        ),
      ),
    );
  }
}

Для некоторых непонятная причина я вижу в консоли эту ошибку

java.lang.RuntimeException: API key not found.  Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
...