Android google maps release key?

前端 未结 4 1020
心在旅途
心在旅途 2020-12-19 15:24

How do I get a release key for Google Maps? I used my current key with a debug.apk and a signed-release.apk, and the maps dont render on the release.apk, so I assume its a A

4条回答
  •  眼角桃花
    2020-12-19 16:07

    From How to configure Google Maps API keys for Android by Dragana Vucic:

    Go to Google API Console -> APIs & Services -> Credentials and click on Create Credentials -> API key. This option will generate a key that is not restricted to anything (yet).

    1. Copy this generated key and click close
    2. In Android Studio: Build -> Select Build Variant -> release
    3. Open file res/values/google_maps_api.xml(release) and paste generated key
    4. Publish app
    5. Go to https://play.google.com/console/developers and select your publich app
    6. Go to page: release management -> app signing
    7. copy SHA-1 certificate fingerprint
    8. Return to https://console.developers.google.com/apis/credentials
    9. Click on release key. In "Key restrictions" section to select "Android Apps"
    10. In "Restrict usage to your Android apps" section enter package name and SHA-1 from Google play console
    11. In "API restriction" section select -> Restrict key -> 1 API.
    12. Click Save

    After these steps, the google map service will work for the published application.

提交回复
热议问题