Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

  • i have seen questions on stackoverflow but didnt got any solution!

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.
like image 538
Saad Asad Avatar asked Apr 23 '13 09:04

Saad Asad


People also ask

Why is Google Maps not working on my Android phone?

Clear the app's cache & data On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find the Maps app. After you select the app, storage & cache options should be available.


1 Answers

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...

like image 196
user754730 Avatar answered Oct 10 '22 18:10

user754730