Google Maps API V2 'Failed to Load Map. Could not contact Google Servers'
For setting up Google Maps API v2 on Android, make sure that you have completed all of the following steps.
App Key For API Access
When Google asks for the SHA1 fingerprint of your app certificate, you will want most likely want to run this twice, once for your debuging certificate, and once for your publishing certificate.
keytool -list -v -keystore publishcert.keystore
keytool -list -v -keystore ~/.android/debug.keystore
The fingerprint of the app on the market is different then the fingerprint of an app that you are just testing!
Enable the service on the Google API Console
Login to the Google API Console.
On the services page, find Google Maps Android API v2
.
Note - Google Maps API v2
is DIFFERENT then Google Maps Android API v2
In the API Access tab, click Create new Android Key
Add your certificate signatures for access to the APIs.
yourrelease-fingerprint;com.example.project.package
yourdebug-fingerprint;com.example.project.package
You will be provided with a generated API Access Key.
You may need to first create an API Project in the API Console
Amend the App Manifest
Add your API Key, inside of the <application>
element.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="yourapikey"/>
Add the following permissions:
<permission
android:name="com.example.project.package.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.project.package.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
Add the following feature request:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
Google Maps API V2 'Failed to Load Map. Could not contact Google Servers', Even I check permission and keystore
did you added all the other need permissions?
<permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
UPDATE:
1.
The meta-data
part should be at the most lower part of the application tag, like so:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.where.common"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.where.common.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.where.common.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.where.common.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDawEkMP7gdiB4nOOkXcdUcxSAvm0kfCmI" />
</application>
2. another problem I see is that you develop your application for API V8, so you have to use the SupportMapFragment
and FragmentActivity
for your Activity
.
3. and last thing for your Map to work you have to add an License activity for Google Licensing info.
Google Maps Android API v2: Failed to Load Map. Could not contact Google Servers
Here's another thing to watch out for: I registered the same SHA1 hash with two different API projects. (Yes, I know this is silly, but I was experimenting with different ways to fix a problem.)
I mention this here, because you may have everything properly configured but you have MORE THAN ONE key for your project on Google's API console. (Here's hoping this silly mistake doesn't happen to you.)
Failed to load map. Error contacting Google servers issue with android google maps api v2
Found it after all, after turning off WiFi on the device I was using. It seems that when debugging over WiFi you also need the
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
in the manifest. Don't know if it was just my case or it's a general thing, but I guess it should be in the documentation somewhere (it's not).
So if you are reading this and having similar problems try either disabling WiFi or adding the above permission alongside the others.
Google maps api v2. Failed to Load Map. Could not connect to google servers
Your manifest implies you have entered your signed api key as the google api key, so I assume you're testing this by installing a signed apk on to the device and not running the app signed with the debug key via eclipse. Is this correct?
Problems like this with API access often come down to an input error with the api key, or an error during the hashing process.
I would make sure that the key in your manifest is correct.
GoogleMap V2 Failed to load map.Error contacting Google servers
I solved these problem by doing the following steps:
In Emulator:
You have to use the latest API
Google APIs(Google Inc.)-API Level
.
19Do the rest of the things placed in the screenshot itself.
API Key:
Create New API Key and Check carefully about Google Map API key and SHA Key.
Google Play Services:
You have to download the latest Google Play Services
com.android.vending-4.8.20.apk.In that site if google play
services wasn't working means you can find a lot of sites in
internet namedcom.android.vending 4.8.20.apk
.you can run the Google play Services by using the Command Prompt
adb install com.android.vending 4.8.20.apk
.Note: You have to download the latest Google play services because year by year latest version will be updated in internet.
output:
Error in Google Maps android android Failed to load map. Could not contact Google servers.
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...
Android Maps: Failed to load map. Could not contact Google servers
1. The first problem I see is here:
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
remove this line:
class="com.google.android.gms.maps.SupportMapFragment"
and set android:name
as:
android:name="com.google.android.gms.maps.SupportMapFragment"
2. Remove this line from the manifest file:
<uses-library android:name="com.google.android.maps" />
This is Google Maps API V1
permission and shouldn't be use in API V2
.
Take a look at this blog post and make sure are doing everything correctly:
Google Maps API V2
3. The problem you describing usually derives from a problem in generating or registering the API key using the API Console, If you are positive that you have made all the steps correctly then I suggest you to delete the debug.keystore folder, compile some project in Eclipse (this will result in a new SHA1 key) and register the key again using the console. Take a look at this blog post I wrote and make sure I are doing all the steps right:
Google Map API V2 Key
Related Topics
Android Webview Click Open Within Webview Not a Default Browser
Getting Permission Denial Exception
Simple Httpurlconnection Post File Multipart/Form-Data from Android to Google Blobstore
Android Background Drawable Not Working in Button Since Android Studio 4.1
Erase Bitmap Parts Using Porterduff Mode
Android Searchview Filter Listview
How to Display More Than 3- Levels of Expandable List View
How Get Permission for Camera in Android.(Specifically Marshmallow)
Problem Inflating Custom View for Alertdialog in Dialogfragment
Gradle Sync Failed Could Not Find Constraint-Layout:1.0.0-Alpha2
Event Onclick for a Button in a Custom Notification
Android Studio Getslotfrombufferlocked: Unknown Buffer Error
How to Share Image + Text Together Using Action_Send in Android
Where Do I Create and Use Scheduledthreadpoolexecutor, Timertask, or Handler
Using Onsaveinstancestate with Fragments in Backstack
Open Specific Activity When Notification Clicked in Fcm
Error:Execution Failed for Task ':App:Transformresourceswithmergejavaresfordebug'