fuiiii
fuiiii

Reputation: 1369

Android Google Map: Failed to load map. Error contacting Google servers

I know there are a lot of same questions out there. I have read them and tried the answers, but mine is still not working.

Error Message:

E/Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

I'm trying to run the Google Map Android Sample Code in /extras/google/google_play_services/samples.

I'm using Android Studio, and my KeyStore is generated by Android Studio. In my developer's console, I enabled both Google Maps Android API v2 AND Google Play Android Developer API. When in the page for generating api key, I used the SHA1 I got from command line after running

keytool -list -v -keystore "THE_KEYSTORE_GENERTATED_BY_ANDROID_STUDIO" -alias "ALIAS"

For the package name I used com.example.mapdemo since in the sample code's manifest, it says:

package="com.example.mapdemo"

I also added

com.google.android.providers.gsf.permission.READ_GSERVICES android.permission.ACCESS_WIFI_STATE

in the manifest.

I'm using Nexus 5 with wifi.

It's still not working and getting the same error.

The API I generated is Public API access. I uninstall the app and clean it from Android Studio and then run it every time I modified the manifest.

The full manifest file

Upvotes: 1

Views: 3825

Answers (4)

Serafins
Serafins

Reputation: 1247

First, check in Logcat your package name. If you use Android Studio check out your build.gradle. If file contain applicationIdSuffix '.dev'. Your should add .dev to your package name.

e.i. package name is:

com.company.main

In API console write

...9S.ME.DA.FE;com.company.main.dev

Upvotes: 0

todd
todd

Reputation: 1286

I would try generating a new API key using the SHA1 from the debug keystore in the .android directory; it is called debug.keystore and should be located in the following directory:

  • OS X and Linux: ~/.android/
  • Windows Vista and Windows 7: C:\Users\your_user_name\.android\

Once you locate it you can get the SHA1 with the following command:

  • OS X and Linux: keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

  • Windows Vista and Windows 7: keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

Upvotes: 3

Kaushik
Kaushik

Reputation: 6162

You have to add another permission too in manifest

<permission
  android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
  android:protectionLevel="signature"/>
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/>

and double check you have generated correct API-Key in google console with your computer's SHA-1;com.example.mapdemo and use that in this project.

Upvotes: 0

Maveňツ
Maveňツ

Reputation: 1

I m also facing the same problem with google map and places services in ios as well as android ..... u can try old api key(which are created 2-3 or more months before) they are working perfect ...

I m sure ur problem would be resolved.

Happy Coding :)

Upvotes: 0

Related Questions