Skip to content Skip to sidebar Skip to footer

Android Google Maps V2 Authentication Error

I get this message in logCat when I attempt to load a supportMapFragment: Failed to load map. Error contacting Google servers. This is probably an authentication issue (but co

Solution 1:

If all your permission settings and API key in manifest are correct, then if you are getting failed to load map, it is probably because of some sort of caching of wrong values that were used earlier. In such case, please uninstall the app completely on the phone in which you are seeing this issue and then do a fresh install.

If you reinstall without uninstalling the app, then the error will persist. Another way to test this effect is that if you have a maps app that is working, then even if you make the API key wrong, the new app with the wrong key will continue to work unless you uninstall the app and freshly install the wrong app

Solution 2:

For me a permission was missing:

<uses-permissionandroid:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

adding it fixed the problem

Solution 3:

In cases, described by tony earlier, where everything else is configured correctly but you still get this error, instead of uninstalling and installing you can simply clear application data.

I found steps that reliably reproduce this problem and solution (works for me):

  • Install release build, signed by your release cert with maps API key issued for you release cert. All works fine.
  • Replace by a debug build, but ``forget'' to change the maps API key from release to debug. Yes, this is wrong and not supposed to work, but this happens when switching builds. Easily solved you thought... Hah!
  • Fix the maps api key in the debug re-build by changing it to the maps API key issued for your debug cert. Re-install debug build with now correct debug maps api key. Expect the maps to work now, but they don't. The problem seems to be on the device itself.
  • Clear app data and same install shows tiles again!

EDIT

This problem may have been fixed in: https://code.google.com/p/gmaps-api-issues/issues/detail?id=6099 If so, it is still unclear to me in which version of the google-play-services API this fix is included.

Solution 4:

The device on which you are testing your application needs to have a logged in Google account. Do you have an active account on all your tested devices? Have the play services been installed on all of the devices?

Solution 5:

This issue also comes, if your project has issues of hostnameverifier. I am using the following solution:

HttpsURLConnection.setDefaultHostnameVerifier(newHostnameVerifier() {
    @Override`enter code here`publicbooleanverify(String hostname, SSLSession arg1) {
        if (hostname.equalsIgnoreCase(arg1.getString("")) {
            returntrue;
        } else {
            returnfalse;
        }
    }
 });  

Post a Comment for "Android Google Maps V2 Authentication Error"