Saad Asad
Saad Asad

Reputation: 2528

Error in Google Maps android "android Failed to load map. Could not contact Google servers."

i am trying to implement google maps in my android application but i am stuck on an error "android Failed to load map. Could not contact Google servers." i have included google play library, got the key using SHA1 certificate fingerprint. i got the SHA1 certificate fingerprint as :

 sudo keytool -v -list -alias androiddebugkey \-keystore /home/.android/debug.keystore

i managed my manifest file according to This

now i am unable to find the cause of this error.. any suggestion is greatly appreciated...

EDIT: my manifest file permissions are as:

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

<uses-permission android:name="PAKG_NAME.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.com.google.android.providers.gsf.permission.READ_GSERVICES" />


<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />


.....................

      <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="MY_KEY" />

and my layout xml have fragment as:

  <fragment
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            class="com.google.android.gms.maps.SupportMapFragment" />

Logcat output:

 E/Google Maps Android API(31478): Failed to load map.  Could not contact Google servers.

Upvotes: 5

Views: 3990

Answers (6)

Gus Fune
Gus Fune

Reputation: 653

I had this problem when refactoring and changing my project bundle identifier. If is this your case, you will have to create a new project on Google Developer Console and link again to your project. For some reason Google blocks requests from the same app if it changes its ID.

Upvotes: 0

Emre Ko&#231;
Emre Ko&#231;

Reputation: 1381

If you are sure about your API key, you should uninstall program from your phone and install again. It worked for me :)

Upvotes: 2

kanilturgut
kanilturgut

Reputation: 39

You should check if you have duplicate API_KEY for the same project. As you know, we will use sha1 key and android project name for getting an API key. If you try to use same sha1;android_project_name pair to get API key, Google will give you another API key. So its duplicated. If you delete the newer one and use the older one in your project, it will solve your problem. At least I hope :)

Upvotes: 0

Luis ibarra
Luis ibarra

Reputation: 31

Try right click on your project and select Properties > Android > and in "Project Build target" select Google APIs. That worked for me :)

Upvotes: 3

user754730
user754730

Reputation: 1340

Are you sure you have enabled "Google Maps Android API v2" and not "Google Maps API v2"? After changing that, delete and recreate the API key. This worked for me...

Upvotes: 4

Nitin Gupta
Nitin Gupta

Reputation: 287

Have u enable Google android map API v2 in console check It properly . I think u enable Google map v2 that why request failed...

Upvotes: 0

Related Questions