Failed to load map. Error contacting Google servers. This is probably an authentication issue

这一生的挚爱 提交于 2019-11-26 10:34:18

it sounds like you have problem with your API_KEY which is obtained from Google API Access ,so verify your API_KEY , certificate fingerprints and package name

also use this inside <manifest>

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

and also verify: <meta-data .... > should be inside <application> tag


PS.

1. Also try by adding following Permission

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

2. After changing API key in AndroidManifest.xml Must Clear Application Data

To Clear Application Data :

Either Go to Settings>Application Manager>Select Your Application > Click on Clear Data

Or Must Uninstall The Application before installing it ! Note Don't Re-install unless you Completely Uninstall the Application in order to clear its Data completely

I spent so much time, there are too many similar questions.

I tried to add own permission, WIFI_STATE permission, but the real problem was in application data.

After you change API key in manifest, you MUST "Clear data" of your application (or completely re-install).

This helps me and I hope this post will help somebody.

My problem was solved by adding permission to the manifest:

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

I have the same issue, and my problem was that I didn't activate the service in the console:

  1. Go to console: https://code.google.com/apis/console/
  2. Go to services section
  3. Enable Google Maps Android API v2
  4. Follow all the steps in the documentacion

If you are have a problem with auth, check in Logcat your package name. If you use Android Studio check out your build.gradle. When file contains applicationIdSuffix '.dev'. You should add .dev to your package name.

e.i. package name is:

com.company.main

In API console write

...9S.ME.DA.FE;com.company.main.dev

After doing everything that people said to like checking my manifest, adding permissions, making a new key with the sha1 in eclipse etc. and it still not working I just did:

adb uninstall com.example.hellomap

and then running through eclipse again. It seemed like the device wasn't getting completely new data. Hope this helps.

Dave

I was able to use the debug key and load from eclipse. I was missing the following permission in my AndroidManifest.xml

uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
user2526136

After reviewing a lot of cases and successfully run the maps, these things are important to have in mind:

  • Use android api 17, booth emulator and project
  • Reference the google services
  • Use the android support if needed
  • Use the following order in libraries: src, gen, google apis, android support, dependencies and private libraries
  • Use a correct api key
  • Clear data, re-install app.

I had configured many services including Google Maps API v2 (not Google Maps Android API v2) which was conflicting. After removing the unwanted service and generating a new key, including in the manifest, clean install, map appeared on the device.

I have fixed the issue by giving the permission in the manifest

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

I was facing the same issue in Android Studio. Google maps would not show up when connected to android debugger.

I fixed it by adding the SHA1 fingerprint for debug keystore located in ~/.android/debug.keystore. I think this keystore is generated by default (not sure though).

The following command in Terminal worked in order to get the SHA1 fingerprint:

keytool -list -v -keystore ~/.android/debug.keystore 

When it asks for password, don't type anything just press enter. (Worked in my case)

Add this fingerprint to your API key for Android applications in developer console.

Cheers!

In my case what worked is that I had to install it via command line :

adb install /path/to/app/MyApp.apk

All you have to do is: use the debug key in your code; uninstall the app; install the new app with the debug key.

In case, if nothing(above stated) works, there is a good possibility that you are using wrong debug.keystore file for generating fingerprint. If you have multiple debug.keystore files in your machine, ensure that you are using the correct debug.keystore to generate the SHA1 fingerprint.

Many of these helped me but the main issue was that I didn't have the correct signing. I am using Xamarin and hence it's not built into the IDE, so when I would generate the key using keytool, it would never get into the application. I had to add the following in my .csproj file:

<PropertyGroup>
   <AndroidKeyStore>True</AndroidKeyStore>
   <AndroidSigningKeyStore>maps.keystore</AndroidSigningKeyStore>
   <AndroidSigningStorePass>android</AndroidSigningStorePass>
   <AndroidSigningKeyAlias>androiddebugkey</AndroidSigningKeyAlias>
   <AndroidSigningKeyPass>android</AndroidSigningKeyPass>
</PropertyGroup>

The error for me was that I was running the debug configuration when I just have added the release configuration to Google Developers Console. So, I followed these steps:

  1. Get the sha1 for your debug keystore using:

    keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

  2. Goto https://console.developers.google.com and add sha1+package.

  3. Add your API_KEY to your AndroidManifest.xml file.

In IntelliJ ..if you sure that you SHA1 key is correct, API key is not missing,

Permission and any setup in Manifest is correct.

Maybe you have to Right Click on your Google-Play-Services-lib and Compile it again

I have done all the things and this does the trick for me.

My the weirdest mistake I have done so far was obtaining SHA1 code from debug.keystore.

I though it has no password, but the password was android

Not sure if it helps anyone, but it helped me. Plus use a full package name, you can find it in java source code file. For example, there is mine: com.example.erikas.mapsdemo ( looks like: package com.example.erikas.mapsdemo; )

So when you try to get a API key, use input like this:

XX:XX:XX:XX:XX:17:C9:22:BB:BD:7C:87:12:83:2D:XX:XX:XX:XX:XX;com.example.erikas.mapsdemo

So my own mistake was a wrong SHA1 code and wrong package. But fortunatelly - I figured it out after 2 days of headache! :D

user3455805

When debugging, I needed to add an additional API key for the ~/.android/debug.keystore

This keystore is setup automatically for you and the password is "android"?

I faced the same problem,Have solution for this, I tried to create debugging api key from different google account with same package name. Step to clear the bug: 1.Remove the unwanted api key with same package name in different google account. 2.Please Maintain the Api key generation in single account for solve this problem. Thank you. Try this.

I was stuck on this question for about a week. So I started to use real device. But one day I try to set Custon debug keystore (Eclipse, Window -> Preferences -> Android -> Build -> Cusom debug keystore) to the same as default one. And all become to work. Of course, first I've got a key at a google console.

Hope this will help!

QuenelleMan

I was facing the same problem. I have tried several solutions - none worked for me. What worked for me was generating a new API key and CLEARING the DATA of the Google play service on my device.

Check list: 1. Check for permission in Android Manifest for READ_GSERVICES

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

  1. Clear application data if you have done some changes in the manifest.

  2. Check debug.keystore in your .android folder.

    My Issue got resolved just by replacing debug.keystore located at .android folder by debug.keystore of your app.

I also faced same issue, while using Android Studio.

I have referred all the solutions, but still it was not working.

The problem was I have changed my package name after initial project setup. Changing package name was reflected in Manifest, but in build.gradle file old package name was there.

As soon as, I have changed package name in build.gradle, Map starts working.

Hope it helps someone.

I had the same problem. I checked Logs and there was said "Authentication failed on the server". So, I checked www.console.developers.google.com and found out that the package name was incorrect. (This package name was automatically written) I wrote it correctly and everything works good.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!