FilipLuch FilipLuch - 1 year ago 198
Android Question

How to fix Google Maps "Authentication failed on the server"?

I have printed my SHA1 key:

keytool -list -v -keystore keystore.jks

generated an API key in Google Console,

updated the manifest file as follows:

<meta-data android:name=""
android:value="@integer/google_play_services_version" />

Then I created a simple
as in Google Samples:

public class MapActivity extends FragmentActivity implements OnMapReadyCallback {

protected void onCreate(Bundle savedInstanceState) {

SupportMapFragment mapFragment =
(SupportMapFragment) getSupportFragmentManager().findFragmentById(;

public void onMapReady(GoogleMap map) {
map.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));


And of course I added the activity inside Manifest file. I always get the same error.

Ensure that the following Android Key exists:
API Key: AIzaSyC1YOn9myapikeystringsxxu5_TnCxlyuRM
Android Application (<cert_fingerprint>;<package_name>):

The strange part is that the SHA1 key which I pasted in Google Console is not the same as the one above. I tried again, and it still shows another SHA1 key. I even tried this SHA1 and still it does not work.

p.s. I have Youtube API integrated in same app, and everything works perfectly, with same KEY.

Answer Source

From the comments you stated that you built the key from the Release version of the app, but the error message suggests that you were testing locally which would also suggest that you're testing with the debug version of your APK.

Since the SHA1 key differs from release to debug, you can keep both keys in your manifest but comment out the release version key while testing locally. Like so:

enter image description here

Edit (April 28 2016) - With Android Studio and build flavors, this technique is unnecessary considering you can point to different strings given a buildType (debug or release) and flavor. I would now recommend andorid:value="@string/maps_v2_api_key" instead of hard coding as such.

buildTypes {
   release {
    resValue 'string', 'maps_v2_api_key', '""'
   debug {
    resValue 'string', 'maps_v2_api_key', '"345...vut"'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download