Reputation: 2528
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
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
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
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
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
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
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