Question

I created a small Android Map project and everything went fine until I move with my workspace to another computer. The google map is not visible and the logcat output has the following line:

07-24 16:15:24.261: E/Google Maps Android API(21868): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors)

My first thought was the missing/wrong keystore because I forgot to copy it from one computer to the other, so I took the SHA1 fingerprint from my new debug.keystore (C:\Users\Enrico.android) and created a new Api key with this fingerprint and put it to Manifest.xml. No result. My second action was to renew the google-play-services_lib but it changed nothing.

Here some interesting parts of my code and from the Api console:

SHA1:

C1:07:A9:8B:E0:B1:FF:49:B4:C3:C6:E8:3B:98:93:FF:8F:D6:36:2F

Api console:

API key:    
AIzaSyDaDJBQyg7I8_Bd3IrKChEdcNo2E7cxU6g
Android apps:   
C1:07:A9:8B:E0:B1:FF:49:B4:C3:C6:E8:3B:98:93:FF:8F:D6:36:2F;com.name.appname

Manifest.xml:

android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDaDJBQyg7I8_Bd3IrKChEdcNo2E7cxU6g"/>
<uses-library android:name="com.google.android.maps" /> 

Please help me!!! EDIT: Another hint. When I first started my App on the new computer, I needed to remove my "old" version from my testphone with the hint, that the signature has changed. So in fact it can only be the wrong SHA1 fingerprint in the debug.keystore file...or?

Was it helpful?

Solution

After you have updated SHA-1 on the API Console, you may need to uninstall and install again the app.

Seems like Google Play Services is keeping "unauthorized" answer from the server in cache.

Edit:

You can try creating another API key without specifying SHA and package name. This will create a key that says "Android apps: Any app allowed". I'm a bit concerned about such possibility, because that key could be used by anyone in their apps, but for development it is not an issue.

OTHER TIPS

You might have forgotten to add add the permission "MAPS_RECEIVE"

Define this permission:

    <permission
        android:name="com.jonasdevlieghere.alma.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

and add it to the list of necessary permissions:

<uses-permission android:name="com.jonasdevlieghere.alma.permission.MAPS_RECEIVE" />

Feel free to change the permission name to match your own application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top