Google Maps V2 not working in production with correct key

后端 未结 8 1265
野性不改
野性不改 2020-12-05 23:26

I\'m having major troubles getting Google Maps working in production within an Android app. This is what I am currently getting (the bottom is just ads).

8条回答
  •  执笔经年
    2020-12-05 23:37

    Based on the logcat output from your debuggable release build:

    01-11 16:04:54.511  19346-19437/com.mike.mapstest E/Google Maps Android API﹕ Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
    01-11 16:04:54.516  19346-19437/com.mike.mapstest 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: YOUR_KEY_HERE
        Android Application (;):  ;com.mike.mapstest
    

    it would appear that you have not overridden the api key placeholder YOUR_KEY_HERE in the manifest (or separate api keys file, depending on your configuration). Replace that string, wherever it lives, with your actual key and you should be good to go.

    Edit: this tutorial, if it matches your configuration, probably explains why you are only seeing this for release builds:

    Return to Android Studio and paste the API key into the YOUR_KEY_HERE section of the file:

    Note that these steps have enabled Google Maps support for the debug version of the application package. The API key will also need to be added to the google_maps_api.xml file located in MapDemo -> app -> src -> release -> res -> values when the release version of the application is ready to be built.

提交回复
热议问题