2

It shows me "Authentication failed on the server" error. App runs without crashing but map is blank.Below i have pasted logcat and MainActivity class of my project.

This is MainActivity of my project

        static final LatLng TP = new LatLng(17.385044, 78.486671);
        private GoogleMap googleMap;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            try {
                // Loading map
                initilizeMap();

            } catch (Exception e) {
                e.printStackTrace();
            }
            /*
             * try { if (googleMap == null) { googleMap = ((MapFragment)
             * getFragmentManager() .findFragmentById(R.id.map)).getMap(); }
             * googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
             * googleMap.addMarker(new MarkerOptions().position(
             * TP).title("TP")); } catch (Exception e) {
             * e.printStackTrace(); }
             */
        }

        @Override
        protected void onResume() {
            // TODO Auto-generated method stub
            super.onResume();
            initilizeMap();
        }

        /* function to load map. If map is not created it will create it for you */
        private void initilizeMap() {
            if (googleMap == null) {
                googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                        R.id.map)).getMap();

                // check if map is created successfully or not
                if (googleMap == null) {
                    Toast.makeText(getApplicationContext(),
                            "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                            .show();
                }
            }
        }
    }

     ## Manifest ##

        <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.cell.track.activity"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-permission android:name="com.example.googlemaps.permission.MAPS_RECEIVE" />

        <uses-sdk
            android:minSdkVersion="14"
            android:targetSdkVersion="22" />

        <permission
            android:name="com.example.googlemaps.permission.MAPS_RECEIVE"
            android:protectionLevel="signature" />

        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="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=".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>

            <uses-library android:name="com.google.android.maps" />

            <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
            <!-- Google MAP API key -->
            <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="AIzaSyA4cNBwKoRxmpW0qhMF8B_jBDpkkHaaSsQ" />
        </application>

    </manifest>

here is logcat:

01-05 11:34:22.841: E/b(24238): Authentication failed on the server.
        01-05 11:34:22.841: E/Google Maps Android API(24238): Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
        01-05 11:34:22.851: E/Google Maps Android API(24238): In the Google Developer Console (https://console.developers.google.com)
        01-05 11:34:22.851: E/Google Maps Android API(24238): Ensure that the "Google Maps Android API v2" is enabled.
        01-05 11:34:22.851: E/Google Maps Android API(24238): Ensure that the following Android Key exists:
        01-05 11:34:22.851: E/Google Maps Android API(24238):   API Key: AIzaSyA4cNBwKoRxmpW0qhMF8B_jBDpkkHaaSsQ
        01-05 11:34:22.851: E/Google Maps Android API(24238):   Android Application (<cert_fingerprint>;<package_name>): 90:A8:E0:F0:90:2F:93:73:C6:16:F0:10:B7:D8:2B:8A:24:08:48:7E;com.cell.track.activity
Zeeshan Shabbir
  • 6,704
  • 4
  • 38
  • 74
  • have you enabled api in developer console ?? – Vivek Mishra Jan 05 '16 at 05:31
  • yes i did but still the map is blank – Hari Mohan Mehta Jan 05 '16 at 05:40
  • is there any need or use of google_maps_api.xml file cause its not in my project is it inbuilt file. – Hari Mohan Mehta Jan 05 '16 at 05:44
  • what does that mean?? – Vivek Mishra Jan 05 '16 at 05:45
  • Have you added your application package and sha1 key correctly? – Krishna Satwaji Khandagale Jan 05 '16 at 06:43
  • crash log says `Could not find method android.app.Notification$Builder.setLocalOnly` which is available only in API level 20 http://developer.android.com/reference/android/app/Notification.Builder.html#setLocalOnly(boolean) and you may be testing it on device having API less than that. I think adding support libraries can help you out – DeltaCap019 Jan 05 '16 at 06:54
  • why do i need to add support libaries cause the target sdk version is 22 @AZone – Hari Mohan Mehta Jan 05 '16 at 08:39
  • go thru http://stackoverflow.com/a/4568358/1206052 to know the difference and significance of `target sdk`. you need support libraries so as to make the functionality available in higher api to the lower one. They provide so as that you can make use of new features in previous apis. Like for fragment is available in both the packages `import android.app.Fragment;` and `android.support.v4.app.Fragment`. You may have also noticed compiler warnings that this method is available in api X and above irrespective of the target sdk – DeltaCap019 Jan 05 '16 at 08:50
  • how should i add the support libaries. @Azone – Hari Mohan Mehta Jan 05 '16 at 09:02
  • @Hari depends which IDE you are using . Google it you will get the solution there are different ways to add it to both Android studio and Eclipse. You can also follow http://developer.android.com/tools/support-library/setup.html – DeltaCap019 Jan 05 '16 at 09:10
  • @Hari if it fixes your problem reply me, I will convert it to an answer – DeltaCap019 Jan 05 '16 at 09:16

3 Answers3

0

Please make sure that you have added your map api key in your manifest. If you have create your api key correctly , then please make sure you have enabled google maps api from developers cosole. I have created a scenario where everything is right exceptt is not enabled . Shown the same error you got. Hope it helps.

0

Probably you didn't configure your project right in google developer console. I answered same question some days ago here on stackoverflow. Link for answer. Follow all the steps mentioned there.

For eclipse. follow steps mentioned in this tutorial

Community
  • 1
  • 1
Zeeshan Shabbir
  • 6,704
  • 4
  • 38
  • 74
-1

Permisions are given?

<permission
        android:name="com.example.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>

Key is added? under application

<meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="abcsddkhashdkashdksadhaskdhsakd" />
Veer3383
  • 1,785
  • 6
  • 29
  • 49