Home » Android » android – Failed to load map. Error contacting Google servers. This is probably an authentication issue

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

Posted by: admin April 23, 2020 Leave a comment


I search all days and I can’t find the answer…

everything is ready but google map still can’t show on fragment with tab

I check that I already turn on google map android v2 and right API_KEY

I have no idea what happened!



public class MainActivity extends FragmentActivity implements
        ActionBar.TabListener {

    SectionsPagerAdapter mSectionsPagerAdapter;

    ViewPager mViewPager;

    protected void onCreate(Bundle savedInstanceState) {
        String titles[] = { this.getString(R.string.title_around),
                this.getString(R.string.title_achievement), };

        final ActionBar actionBar = getActionBar();

        mSectionsPagerAdapter = new SectionsPagerAdapter(

        mViewPager = (ViewPager) findViewById(R.id.pager);
                .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
                    public void onPageSelected(int position) {

        for (int i = 0; i < titles.length; i++) {

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;

    public void onTabSelected(Tab tab, FragmentTransaction fragmentTransaction) {

    public void onTabUnselected(ActionBar.Tab tab,
            FragmentTransaction fragmentTransaction) {

    public void onTabReselected(ActionBar.Tab tab,
            FragmentTransaction fragmentTransaction) {

    public class SectionsPagerAdapter extends FragmentPagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {

        public Fragment getItem(int position) {
            // TODO 在這邊決定哪個位置要給什麼 View(Fragment)
            Fragment fragment = null;
            // TODO 建議先在之前就初始化好 4 個 Fragment
            switch (position) {
            case 0:
                fragment = new AroundFragment();
            case 1:
                fragment = new MapsFragment();
            case 2:
                fragment = new FavoriteFragment();
            case 3:
                fragment = new AchievementFragment();

            return fragment;

        public int getCount() {
            return 4;

        public CharSequence getPageTitle(int position) {
            // TODO 在這邊決定每一個 View 的 title
            switch (position) {
            case 0:
                return getString(R.string.title_around);
            case 1:
                return getString(R.string.title_map);
            case 2:
                return getString(R.string.title_favorite);
            case 3:
                return getString(R.string.title_achievement);
            return null;



public class MapsFragment extends Fragment{
    static final LatLng NKUT = new LatLng(23.979548, 120.696745);
    private GoogleMap map;
    SupportMapFragment mMapFragment;
    public MapsFragment() {


    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.map_fragment,container, false);

        map = ((SupportMapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();

         mMapFragment = SupportMapFragment.newInstance();
         FragmentTransaction fragmentTransaction =

        return rootView;



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    tools:context=".MainActivity" >

        class="com.google.android.gms.maps.SupportMapFragment" />



<!-- Google Map -->
<uses-permission android:name="com.jertt.yummymap.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"/>
<!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<!-- end -->
    <!-- Google Map API Key -->

        android:value="key" />

    <!-- end -->


I found the solution!!!

If you use private keystore to apply API_KEY. You cannot upload and install application with eclipse.

You need to upload .apk file to your device by yourself and install it!

Thanks Tarsem and srikanth gr help!!

How to&Answers:

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>

        android:required="true" >

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


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:


In API console write



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.


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"


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.



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:



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:


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


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!


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.