如何让 google 地图在 flutter 中工作?
How to get google maps to work in flutter?
我已按照软件包开发页面上的步骤进行操作:https://pub.dev/packages/google_maps_flutter
但是当我 运行 输入我的 api 键后,我得到的只是一个空白屏幕,如下所示:
Screenshot
AndroidManifest.xml 看起来像这样:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="foodiesapp"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyB........"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
主页是包开发页面示例中的确切代码:https://pub.dev/packages/google_maps_flutter
有人知道问题出在哪里吗?
将 API_KEY 元数据移动到主要 activity 之上。
<application
android:name="io.flutter.app.FlutterApplication"
android:label="foodiesapp"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyB........"/> <!--here-->
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
我已按照软件包开发页面上的步骤进行操作:https://pub.dev/packages/google_maps_flutter
但是当我 运行 输入我的 api 键后,我得到的只是一个空白屏幕,如下所示:
Screenshot
AndroidManifest.xml 看起来像这样:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="foodiesapp"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyB........"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
主页是包开发页面示例中的确切代码:https://pub.dev/packages/google_maps_flutter
有人知道问题出在哪里吗?
将 API_KEY 元数据移动到主要 activity 之上。
<application
android:name="io.flutter.app.FlutterApplication"
android:label="foodiesapp"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyB........"/> <!--here-->
<activity
android:name=".MainActivity"
android:launchMode="singleTop"