6

1) Created new project.

2) Selected google map created.

3) Debug google_maps_api.xml steps followed.

4) Release google_maps_api.xml steps followed.

  • developers.google.com/maps/documentation/android/signup steps.

  • keytool -list -keystore your_keystore_name

  • keytool -list -v -keystore your_keystore_name -alias your_alias_name

  • SHA1: :0D::74:D3::E1:43::71::62:90::A1:66:6E:__:5D:75 added

  • created google developer console API key.

  • <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"> AIzaSyB3d_usre_Joj_TrgP3aKtdkrSt_tTeqGI </string>

    added different release key.

5) AndroidManifest.xml

  • <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key" />

  • <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.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

6) Generate signed APK created, Build Type release version created.

7) Beta version published on play store.

8) Google map screen blank.

9) But local running app google map working fine.

10) All package name correctly added on google developer console.

Thamays
  • 2,978
  • 26
  • 31
  • hmm, only thing that jumps to mind is you may be missing ```google-services.json``` does that mean anything to you? Ahh sorry I didn't see you mention release - is your keystore different for release? You need a SHA1/APIkey for that build type/keystore – Saik Caskey Aug 07 '17 at 15:20
  • For instance, debug usually uses the AndroidDebugKey located in ```~/..android/debug.keystore```, but you probably have a keystore set up for release specifically, that doesn't use the debug key, so get a SHA1 for that keystore, or just run the Gradle Tasks> android> signingReport to see! – Saik Caskey Aug 07 '17 at 15:24
  • You should see something in the Logcat. Can you share the Logcat as well? – xomena Aug 09 '17 at 15:12
  • Have you tried [this](https://stackoverflow.com/a/45604031/8244632) way for release api key? if not just try. – Lalit Fauzdar Aug 11 '17 at 04:06
  • it's play store app.. not showing logcat about google map.. – Thamays Aug 11 '17 at 05:43
  • #Lalit Singh Fauzdar i flowed this steps not working – Thamays Aug 11 '17 at 05:47
  • OK. The moderator has deleted my answer and I cannot mark this question as duplicated because it has bounty. So I just post the link where you can see answer: https://stackoverflow.com/a/44672565/5140781 – xomena Aug 11 '17 at 16:27
  • Hello @a.g.thamays . Check this answer: https://stackoverflow.com/a/45643471/2151779 – ymerdrengene Aug 14 '17 at 14:21
  • Does this answer your question? [Android Studio - Google map still blank on real Android device on release apk](https://stackoverflow.com/questions/30559602/android-studio-google-map-still-blank-on-real-android-device-on-release-apk) – Sweta Jain Nov 10 '21 at 13:14

4 Answers4

5

I am assuming that this may due to mismatch SHA 1 Fingerprint. Double check that you are using the same keystore for getting SHA1 and apk release.

or Let's check your API key is valid or not. For that add following MAP_API as your release key

AIzaSyDztCvpv3PVBxzWwY7mWqCMnGfDeOiGxwY

Add following permission in your AndroidManifest.xml (Optional/not necessary)

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

Build your release apk. And test it.

If the map is showing then we can fix that your API key is the problem.

So get Sha1 one more time and update in your google developer console.

whackamadoodle3000
  • 6,684
  • 4
  • 27
  • 44
Vinayak B
  • 4,430
  • 4
  • 28
  • 58
1

You are generating SHA-1 in cmd. sometimes cmd returns local SHA-1 not Administrator. So try to create SHA-1 from Android studio. follow steps to generate SHA-1:

  1. Click on Gradle (right panel of the studio where Preview option shows)
  2. Click on Project name
  3. click on Task
  4. click on android
  5. then click signingReport

your SHA-1 is generated copy this SHA-1 and paste in google console.

Mahesh Gawhane
  • 348
  • 3
  • 20
1

I think your still using your SHA1 for debug.keystore on your release build.. try to get your SHA1 on your release keystore.

Windows Terminal

keytool -list -v -keystore "{PATH OF YOUR RELEASE KEYSTORE}" -alias {ALIAS} -storepass {StorePassword} -keypass {KeyPassword}

OSX Terminal

keytool -list -v -keystore {PATH OF YOUR RELEASE KEYSTORE} -alias {ALIAS -{STORE PASS} android -keypass {KEYPASS}

Get your SHA1 and register it on your Google API Console..

Hope it helps. .

Rai
  • 187
  • 2
  • 15
0

the problem was my package name....i was creating the MapActivity inside a folder...so android studio was automatically setting up my package name as com.example.myappname.myfoldename instead of just com.example.myappname in google_api.xml as result in google console too.

i highly recommend that you try this solution...generate a new api key and check your package name too.

desertnaut
  • 57,590
  • 26
  • 140
  • 166