Google Maps Android API v2 - Debug key API is not working

Asked

Viewed 608 times

0

I’m trying to use the Google Maps Android API v2 on my Android app. It was running on another developer’s micro, with the debug.keystore but with my debug.keystore (located in C:\Users\Meu Usuário\.android\debug.keystore) is not working.

To Google Maps Android API v2 is enabled and I have already created a API Key following the normal steps:

  1. Rotate the command keytool -list -v -keystore debug.keystore to get the SHA1 string;
  2. Use SHA1 string to create a API key in the Google Developers Console following the format stringSHA1;br.com.meuapp;
  3. Include the API key in my AndroidManifest.xml:

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
    
    <permission
        android:name="br.com.meuapp.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="br.com.meuapp.MAPS_RECEIVE"/>
    
    <uses-permission android:name="android.permission.INTERNET" />
    <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.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    
    <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true"/>
    
    <application
        ...
    
        <uses-library android:name="com.google.android.maps" />
    
        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    
        ...
    
        <!-- Debug API key -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSy*********************************"/>
    
    </application>
    

However, nothing is solving (the map does not appear) and Logcat always shows the error below:

06-02 17:25:51.601: E/Google Maps Android API(5354): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

Device connectivity is OK.

I’ve already checked and re-checked the generation of API key, the value of string SHA1, etc.

In order to allow compatibility with Android versions below 3.0 I am using the compatibility Apis (SupportMapFragment, etc.).

The version of my library Google Play Services is 4323000.

I’m using the Eclipse.

Does anyone know how to solve?

2 answers

0

I think I know what’s wrong with your map.

There are two SHA1 strings that are generated, one for apk and one to use when the app starts with the IDE.

The one you should need to register with google is the one from the IDE you can find in the ADT under Window -> Preferences ->Android -> Build.

  • Actually the two come from the same Keystore, which is located on the path I mentioned, so they have the same value as SHA1.

0


Oddly enough, I turned on the computer and the test device today and the map worked. I believe that this reboot was missing or else give time to the API Key be accepted by Google servers. Anyway the problem is solved. I thank those who were willing to help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.