Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
244 views
in Technique[技术] by (71.8m points)

android - Google maps v2: Authorization failure

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.company.app, API Key: AIzaSyC***OsTeo, Certificate Fingerprint: 4E5285***6BF53ED3 Failed to contact Google servers. Another attempt will be made when connectivity is established.

Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).


I know there are more then enough questions about this subject. But I just can't seem to get the maps view to work. The result is an empty maps view (with zoom buttons).

What I've done:
- Downloaded / installed google-play-services
- Added google-play-services.jar to libs/
- Enabled Google Maps API v2 in code.google.com/apis/console
- Set up the correct permissions

This is how my manifest looks like:

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

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

<permission
    android:name="com.company.app.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.company.app.permission.MAPS_RECEIVE" />

<application ...>
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyC***OsTeo" />
</application>

Google APIs console api access looks like this:

Key for Android apps (with certificates)
API key:        AIzaSyC***OsTeo
Android apps:   4E:52:85:***6B:F5:3E:D3;com.company.app
Activated on:   Jun 18, 2013 11:07 PM
Activated by:   my@email.com – you

And some code (which I can't see why this would result in an authorization error):

FragmentManager fragmentManager = super.getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
SupportMapFragment fragment = new SupportMapFragment();
fragmentTransaction.replace(R.id.mapContainer, fragment);
fragmentTransaction.commit();

As you can see I get an error saying the package name, api key and certificate fingerprint do not correspond with the google servers. But like I'm writing above, those values do match...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Activate the Google Maps Android API v2 service in the Google API's console. Also, after making changes do a full reinstall of the app on the device/emulator.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...