0

I'm trying to use Google Maps Android API v2 in my android app but the result is a blank (gray) map displayed with button of zoom i tried many tutorial but the result is the same. Android studio, unix

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name="com.example.app.Authentification"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name=".MainActivity" ></activity>



    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />


    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value=" My key " />



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

    <activity android:name=".Send_remarquesSugges" ></activity>
    <activity android:name=".SendMailActivity" ></activity>
    <activity android:name=".Menu_Genaral" ></activity>
    <activity android:name=".AddChantier" ></activity>
    <activity android:name=".AddZone" ></activity>
    <activity android:name=".AddProjet" ></activity>
    <activity android:name=".AddProspect" ></activity>
    <activity android:name=".activity_Commercial" ></activity>
    <activity android:name=".AddClient" ></activity>
    <activity android:name=".AddSuiviChantier" ></activity>
    <activity android:name=".AddCommercial" ></activity>
    <activity android:name=".daoServer.Activity_add_chantier" ></activity>
    <activity android:name=".Menu_Visite" ></activity>
    <activity android:name=".AddReclamationn" ></activity>
    <activity android:name=".add_projet3" ></activity>
    <activity android:name=".AddRecouvrement" ></activity>
    <activity android:name=".AddRetourrs" ></activity>
    <activity android:name=".Cartographie" ></activity>
    <activity android:name=".Affectation" ></activity>
    <activity android:name=".ActivityRendezVous" ></activity>
    <activity android:name=".contacts" ></activity>
    <activity android:name=".AddRendezvous" ></activity>
    <activity android:name=".Add_RD" ></activity>
    <activity android:name=".Menu_RD" ></activity>
    <activity android:name=".AddCmd3" ></activity>
    <activity android:name=".menu_contact" ></activity>
    <activity android:name=".AddContact" ></activity>
    <activity android:name=".AddSuiviProspect" ></activity>
    <activity android:name=".menu_type_cmde" ></activity>
    <activity android:name=".Add_Articles" ></activity>
    <activity android:name=".menu_parametre" ></activity>
    <activity android:name=".Menu_GenaralAdmin" ></activity>
    <activity android:name=".Cartographie_2" ></activity>

    <activity android:name=".mainnActi_Rendez_vous" ></activity>
    <activity android:name=".AddCmd_Tele" ></activity>
    <activity android:name=".AddCam" ></activity>
    <activity android:name=".menu_projet3" ></activity>
    <activity android:name=".AddVisite2__" ></activity>
    <activity android:name=".mainnActi_client" ></activity>
    <activity android:name=".AddCmd2" ></activity>

</application>

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

<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

My build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:4.+'
    compile 'com.android.support:appcompat-v7:19.1.0'
}

Thanks for your help.

i tried many tutorail like this one http://glennsayers.com/android-mapping/ i cant post image the result is the same of this link with google writed in down of page http://android-er.blogspot.fr/2012/12/google-maps-android-api-v2-with-blank.html

  • Did you set your api key? – Itay Sep 23 '14 at 09:51
  • in the device :s, yes the api key is correct i tried to creeate a new project with one activity who display the map with new key but the same result, blank page whith zoom button. – mehdi loutfi Sep 23 '14 at 10:24

2 Answers2

2
 <uses-permission android:name="your.package.name.permission.MAPS_RECEIVE" />

this permission is missing.

Ankit Kumar
  • 3,276
  • 2
  • 20
  • 36
0

I had the same problem using android studio. The official documentation says that you have to get your sha1 key from debug.keystore but that is not true at all. You have to use the sha1 key from your .jks file.

I´m not sure how to get this but I found it using eclipse. You choose any project and when you export a project you choose your key. In the end of the process you see your sha1, this is the real certificate and it's different than in debug.keystore.

See this SO answer for reference.

Community
  • 1
  • 1
Rene Limon
  • 564
  • 3
  • 13
  • 29