【问题标题】:Cannot display google map after changing keystore更改密钥库后无法显示谷歌地图
【发布时间】:2013-12-20 12:52:54
【问题描述】:

我有一个可用的地图应用程序,但是在我更改密钥库后,还创建了 api 密钥,并将其更新到我的 AndroidMenifest 中,地图不再显示,

我发现了一些有趣的事情,错误日志中的证书指纹和 api 密钥与我创建的密钥库和控制台 api 密钥完全不同。

我的 api 密钥是 AIzaSyA-XXXXXXXXXXXXXXXXXXXXJhfQCboM SHA1 是 FE:CF:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:8A:0D

下面是我的清单:

<application
    android:allowBackup="true"
    android:icon="@drawable/es100x100"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:debuggable="true" >

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyA-XXXXXXXXXXXXXXXXXXXXXXXJhfQCboM" />

    <activity
        android:name=".MainFragmentActivity"
        android:theme="@android:style/Theme.NoTitleBar"
        android:windowSoftInputMode="adjustPan"
        android:label="@string/app_name"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

错误日志

Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
Ensure that the following correspond to what is in the API Console: Package Name: esoft.com.edm, API Key: AIzaSyBxxxxxxxxxxxxxxxxxxxxxxxxxx_eSh-E, Certificate Fingerprint: 5BFD72xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxD031
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

希望有人能让我弄清楚我错过了什么......

【问题讨论】:

  • 看看我的回答。
  • 我现在也遇到了同样的问题。你找到解决办法了吗?

标签: android google-maps-api-2 api-key rsa-key-fingerprint


【解决方案1】:

如果您确定您的 API 密钥是正确的,并且确实是在您已签署的密钥库中注册的 API 密钥,您可以检查一些事情。

  1. 您是否将应用程序的包名称更改为新名称?然后,您需要在 Google API 控制台上为您的新软件包名称添加一个新条目。

  2. API 密钥缓存在应用程序中。即使将其更改为新的并安装后,该应用程序仍会使用旧的一段时间。您可以尝试卸载并重新安装该应用,看看是否有帮助。

【讨论】:

  • 我已经检查并尝试使用新包创建一个新项目,还注册一个新的api密钥,并启用google map api v2,但问题仍然存在......顺便说一句为什么新项目仍然获得旧的 api 密钥和 SHA1?
  • 不,我的意思是,当您更改 API 密钥并在现有的应用程序上重新安装应用程序时,包含旧的 API 密钥。
  • 当我从 Exlipse 安装应用程序时,地图是空白的,但是当我 exprt 签名 apk 时,地图工作......真的很烦......谢谢 Kunar Bibek
  • 从 Eclipse 安装,使用调试密钥库对其进行签名,API 密钥将是错误的。您还应该添加 Debug 密钥库的 SHA1,然后在通过 eclipse 安装时它也应该可以工作。
  • 将调试密钥库的 SHA1 添加到清单中??
【解决方案2】:

确保您已在控制台中启用“Google Maps Android API v2”功能。还要确保您已按照HERE 所示的所有配置步骤进行操作

您是否通过添加您的 SHA1 并附加您的包名称来生成您的 API 密钥,如图所示?

如下例:

BE:03:E1:44:39:7B:E8:17:02:9F:7F:B7:98:82:EA:DF:84:D0:FB:6A;com.test.googlemapsv2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-17
    • 1970-01-01
    • 2016-09-30
    相关资源
    最近更新 更多