更新Android应用目标SDk和Gradle后,Google地图不提供地图

问题描述 投票:0回答:1

我开发了一个应用程序,它使用Google Maps for Android来显示基于GeoJSON文件的地图和路线。应用程序运行正常,直到我决定更改项目的某些功能。第一步,我将目标SDK版本从23改为25,Android工具从1.2改为3,Gradle从2.1改为4.但是通过这些小改动,GM只在片段中显示“Google”徽标而不是地图。在AS中,logcat给了我这个错误:

E/Google Maps Android API: Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
                           Ensure that the "Google Maps Android API v2" is enabled.
                           Ensure that the following Android Key exists:
                           API Key: ---- I removed it intentionally ----

这是我的AndroidManifest,你可以看到V2已启用。

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>

出于第二个可能的原因,我检查了Google凭据,API密钥也是有效的。我怎样才能解决这个奇怪的问题?

android google-maps-android-api-2
1个回答
0
投票

我发现问题是因为我当前的API密钥是应用程序限制的,我创建另一个凭据并获得另一个API密钥,它工作正常。

© www.soinside.com 2019 - 2024. All rights reserved.