Why doesn't Google Map show on release key?

南笙酒味 提交于 2019-12-11 21:25:10

问题


Why doesn't Google Map show on release authentication key?

Before I use release key, it ran normally.

Here is my log:

09-10 11:01:25.361: E/b(21729): Authentication failed on the server.
09-10 11:01:25.361: E/Google Maps Android API(21729): Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
09-10 11:01:25.391: E/Google Maps Android API(21729): In the Google Developer Console (https://console.developers.google.com)
09-10 11:01:25.391: E/Google Maps Android API(21729): Ensure that the "Google Maps Android API v2" is enabled.
09-10 11:01:25.391: E/Google Maps Android API(21729): Ensure that the following Android Key exists:
09-10 11:01:25.391: E/Google Maps Android API(21729):   API Key: AIzaSyBiDi1b8SwwYsr08rbRtI6UJt71kwbZrNE
09-10 11:01:25.391: E/Google Maps Android API(21729):   Android Application (<cert_fingerprint>;<package_name>): 4F:B8:B5:15:F1:FB:2F:6D:27:00:2E:C4:91:B8:FE:E1:18:7D:46:80;bamb.nitaf.wedding

回答1:


I think you have used some different key in your manifest. Please visit Google developers console and create your own api key for using Google maps in your application. As you can clearly see the terminal says the key doesn't exist. Follow the below link to know more on this topic.

http://examples.javacodegeeks.com/android/core/google-maps/android-google-maps-v2-tutorial/




回答2:


Please make sure about the following things about Google Map V2:

1.Generating correct SHA-1 for your release key.

2.Generating the API key with the correct package name and the generated SHA-1

3.Defining the correct permissions in manifest.xml to access the map:

<permission
        android:name="yourpackagename.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="yourpackagename.permission.MAPS_RECEIVE" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

  <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

  <!-- Goolge API Key -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="yourApiKey" />

4.Lastly enabling Google API MAPV2 in developer console.

In your case,I suspect that the SHA-1 for your releaese mode is wrong and hence the error.

Please see this to generate API Key correctly.



来源:https://stackoverflow.com/questions/32492583/why-doesnt-google-map-show-on-release-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!