質問

I had a workable map app, but after i changed the keystore, also create api key, and update it into my AndroidMenifest, the map was not display anymore,

and I found something interesting, that the certificate Fingerprint and api Key in error log are totally different as keystore and console api key I created.

My api key is AIzaSyA-XXXXXXXXXXXXXXXXXXXXJhfQCboM and SHA1 is FE:CF:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:8A:0D

Here are my manifest below:

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

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

    <activity
        android:name=".MainFragmentActivity"
        android:theme="@android:style/Theme.NoTitleBar"
        android:windowSoftInputMode="adjustPan"
        android:label="@string/app_name"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

</application>

Error log

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: esoft.com.edm, API Key: AIzaSyBxxxxxxxxxxxxxxxxxxxxxxxxxx_eSh-E, Certificate Fingerprint: 5BFD72xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxD031
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

hope some one can let me figure out what I missed...

役に立ちましたか?

解決

If you are sure that your API key is correct and is indeed the API key registered with the keystore that you have signed with, you could check a few things.

  1. Did you change the package name of your app to something new? Then you would require to add a new entry for your new package name on the Google API console.

  2. The API key is cached in the app. Even after changing it to a new one, and installing it, the app uses the old one for some time. You could try uninstalling and re-installing the app, and see if it helps.

他のヒント

Make sure you have enabled the feature of "Google Maps Android API v2" in your console. Also make sure you have followed all the steps of configuration as shown HERE

enter image description here

Have you generated your API key by adding your SHA1 and appending your Package name as shown in image?

enter image description here

Like as below example:

BE:03:E1:44:39:7B:E8:17:02:9F:7F:B7:98:82:EA:DF:84:D0:FB:6A;com.test.googlemapsv2

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top