Reputation: 73
I created an Android application with Google Maps. It works fine on my emulator (I generated an API key on my Google account and pasted it into the "src\debug\res\values\google_maps_api.xml" file). However, when I try to create a release or debug APK, Google Maps is not displayed.
Step 1: I added a new API_KEY in the release file "src\release\res\values\google_maps_api.xml".
Step 2: I generated a key.jks file with Android Studio (Build -> Generate Signed Package/APK)
Step 3: Then used keytool -list -v -keystore pathToMyKey.jks to get the SHA-1 fingerprint. I pasted this fingerprint on the SHA-1 section of this API_KEY and added the com.example package name (I did not add a package),
Step 4: I built the signed APK, but I can not see Google Maps (the empty screen with a Google logo).
I know this subject is common but I can not see where my mistakes are. I tried several things to debug, with no results: add the same key to debug/release (and also paste the SHA-1), change the name of the SHA-1 package to com.example.MyApplication.app, create a new API_KEY and starting again ...
Upvotes: 2
Views: 572
Reputation: 1506
You need to add SHA-1 to Cloud Console project you are using the API in. For debug and unpublished release add the one you get from Android Studio after running signingReport. If you are publishing the app and using Play Console signing you also need to add that SHA-1 as well.
Upvotes: 1