Geo
Geo

Reputation: 31

Google map keep geting a blank screen on android

need some help here please.

I have an guide app on AppStore and i'm trying to build the same app for android but i have some problems with Google Maps, keep geting a blank screen.

-I have follow instructions from: https://developers.google.com/maps/documentation/android/start.

This what i have done so far.

-Have install Eclipse Keytool

-Have added Google Play Services Library in the project

-Have great SHA1 figerprint

-Have great Key for Android apps (with certificates) form Google Developer

-Past the key in manifest.xml

-Have delete the google-play-services-remove.jar from the lib file.

Have no errors or warnings when i test my app on a real device, but i have this red lines in my LogCat:

(Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.

Ensure that the following correspond to what is in the API Console: Package Name: com.cyououtandroid, API Key: AIzaSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXGkyAxg, Certificate Fingerprint: DF6E6EXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0F2E5)

Im sure that im missing something but I can't figure it out.

Upvotes: 1

Views: 1605

Answers (3)

Shailendra Madda
Shailendra Madda

Reputation: 21551

See here,just change the api key with your key in manifest file and follow these steps: and make sure that generate api key with package name which is mentioned in android manifest file and your google_play_services_lib project should be present in your project's work space only.

Manifest file:

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.geeklabs.map.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="replace with your API key"/>

    </application>

</manifest>

MainActivity.java:

    package com.geeklabs.map;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

}

activity_main.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.google.android.gms.maps.MapFragment"/>

And make sure following steps done correct or not:

Steps: * to ensure that device has Google Play services APK * to install Google Play Service rev. more than 2

enter image description here

  • to create project at https://code.google.com/apis/console/
  • to enable "Google Maps Android API v2" enter image description here
  • to register of SHA1 in project (NOW, YOU NEED WRITE SHA1;your.app.package.name) at APIs console and get API KEY
  • to copy directory ANDROID_SDK_DIR/extras/google/google_play_services/libproject/google-play-services_lib to root of your project
  • to add next line to the YOUR_PROJECT/project.properties

android.library.reference.1=google-play-services_lib

  • to add next lines to the YOUR_PROJECT/proguard-project.txt

-keep class * extends java.util.ListResourceBundle {

protected Object[][] getContents();

}

Okay, now you ready to create your own Google Map app with using Google Map APIs V2 for Android.

If you create application with min SDK = 8, please use android support library v4 + SupportMapFragment instead of MapFragment.

After got this let me know.

Follow this step by step process to get map in v2:

https://developers.google.com/maps/documentation/android/

http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/

Upvotes: 2

Usman Kurd
Usman Kurd

Reputation: 7023

Check the Following Things 1st

  • you have added Debug SHA1 key (for testing)

  • You have added Release SHA1 key (key generated from Signed apk for release)

    Your combination of Package to Key is incorrect thats why you are getting authentication failed.

Note: Don not remove the Maps.jar from your java build Path & google play serivce lib.

Upvotes: 3

Guru
Guru

Reputation: 916

It looks like you are not generating the API key properly.

When you generate the key , make sure you have "SHA1;packagename" separated by a ";".

Also make sure you have maps.jar and google-play-services.jar in your build path.

maps.jar - /android-sdk/add-ons/google-apis-(whichever version)/libs/maps.jar

*google-play-services - android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs*

Upvotes: 1

Related Questions