2

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?

Enrico Buß
  • 23
  • 1
  • 7

2 Answers2

1

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.

MaciejGórski
  • 22,187
  • 7
  • 70
  • 94
  • Thank you for your answer. I uninstalled and installed it several times without success. I found another error in the logcat output: `Could not find class 'maps.ag.l', referenced from method maps.ah.an.a` – Enrico Buß Jul 24 '13 at 20:13
  • @EnricoBuß This warning can be ignored. I have updated the answer. – MaciejGórski Jul 24 '13 at 20:18
  • It works with the "Any app allowed key" thank you very much. I'm a little bit confused about this possibility but for development it is o.k. for the moment. – Enrico Buß Jul 24 '13 at 20:36
  • It got me confused too at first. Now it makes me think. Either the key is important and should be mapped to private data (package name and signing key) or it is not important at all and could be removed. – MaciejGórski Jul 24 '13 at 21:01
  • That would be a consistent behavior instead of "any app allowed key" – Enrico Buß Jul 24 '13 at 21:08
0

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.

Jonas
  • 1,021
  • 11
  • 17
  • Hello John, thanks for your answer but I think that is not the problem. I already defined the permissions in my manifest.xml: – Enrico Buß Jul 24 '13 at 14:46
  • Are you trying to run the exported app or are you debugging over ADB? In the former case you need the API key based on your Android keystore, in the latter you'll need to generate a new API key for each computer, since the debug keystore will de different every time. – Jonas Jul 24 '13 at 15:58
  • I'm debugging over ADB and I created a new API key based on the SHA1 of the new debug keystore. – Enrico Buß Jul 24 '13 at 17:30