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: [email protected] – 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...
Note that the Maps Embed API, Maps SDK for Android, and Maps SDK for iOS currently have no usage limits and are at no charge (usage of the API or SDKs is not applied against your $200 monthly credit).
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.
For me help this, if simple: When you work from Android Studio you write your Google API key in file google_maps_api.xml but Android Studio show you only key file for (debug) version in Project Manager. You need place your key in
\app\src\release\res\values\google_maps_api.xml
file too (like you place in place your key in
\app\src\debug\res\values\google_maps_api.xml
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With