-1

Update 2:

I changed the line the the build.gradle (Module: app) from

compile 'com.google.android.gms:play-services:8.1.0'

To:

compile 'com.google.android.gms:play-services-maps:8.3.0'

Now I get error:

'W/GooglePlayServicesUtil: Google Play services out of date.  Requires 8298000 but found 8185470'

The emulator also has a button that says "Update" now on the screen and says "XXX won't run unless you update Google Play services."

Update:

I noticed on the error line:

Android Application (<cert_fingerprint>;<package_name>): 63:99:6C:AC:5A:45:3C:8B:26:D1:7F:45:52:E5:FB:01:A3:00:8E:E2;com.lightningboltstudios.audubontrailmap

The SHA-1 certificate fingerprintis listed as:

63:99:6C:AC:5A:45:3C:8B:26:D1:7F:45:52:E5:FB:01:A3:00:8E:E2

On the google_maps_api.xml it says:

You can also add your credentials to an existing key, using this line: A8:79:0D:B6:52:CC:C3:48:F8:E2:53:F4:7C:DB:F6:FF:90:AC:18:E0;com.lightningboltstudios.audubontrailmap

So now I'm just lost. It almost seems like it's trying to use an API key with a different SHA-1 certificate fingerprint then is in google_maps_api.xml file, and that is the SHA-1 that I typed into google to generate the API key.

It should be noted I've also tried to create a new key and enter that one. Same issue.

Original Post:

I'm trying to make a google maps activity on an emulator in Android studio (Nexus 5), but every time I ran it, it would say that I needed to update my emulator. I was told to change my build.gradle (Module:app) from:

compile 'com.google.android.gms:play-services:8.3.0'

To:

compile 'com.google.android.gms:play-services:8.1.0'

Then I started to get this new error:

E/b: Authentication failed on the server.
E/Google Maps Android API: Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: (redacted)
Android Application (<cert_fingerprint>;<package_name>): 63:99:6C:AC:5A:45:3C:8B:26:D1:7F:45:52:E5:FB:01:A3:00:8E:E2;com.lightningboltstudios.audubontrailmap

My activity file activity_trail_map.xml is:

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lightningboltstudios.audubontrailmap.TrailMapActivity" />

My TrailMapActivity java file is:

    package com.lightningboltstudios.audubontrailmap;

    import android.support.v4.app.FragmentActivity;
    import android.os.Bundle;

    import com.google.android.gms.maps.CameraUpdateFactory;
    import com.google.android.gms.maps.GoogleMap; 
    import com.google.android.gms.maps.OnMapReadyCallback;
    import com.google.android.gms.maps.SupportMapFragment;
    import com.google.android.gms.maps.model.LatLng;
    import com.google.android.gms.maps.model.MarkerOptions;

    public class TrailMapActivity extends FragmentActivity implements     OnMapReadyCallback {

    private GoogleMap mMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_trail_map);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }


    /**
     * Manipulates the map once available.
     * This callback is triggered when the map is ready to be used.
     * This is where we can add markers or lines, add listeners or move the camera. In this case,
     * we just add a marker near Sydney, Australia.
     * If Google Play services is not installed on the device, the user will be prompted to install
     * it inside the SupportMapFragment. This method will only be triggered once the user has
     * installed Google Play services and returned to the app.
     */
    @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;

        // Add a marker in Sydney and move the camera
        LatLng sydney = new LatLng(-34, 151);
        mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    }
}

My google_maps_api.xml values file is:

<resources>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">(redacted)</string>

obizues
  • 1,473
  • 5
  • 16
  • 30
  • The emulator doesn't come with play services, so you'll need to get that installed somehow. I've never gotten it to work. – nasch Dec 08 '15 at 22:52
  • When I first went to their website to try it out a week ago it worked just fine. They have a step by step process. This time however it isn't working. [Setup Google Play Services](https://developers.google.com/android/guides/setup) – obizues Dec 08 '15 at 22:54

1 Answers1

1

This is currently a limitation for Android Studio emulators and for Genymotion as a plugin. You simply need to use an actual device to work with anything that uses google play services at this point in time (12/14/2015)

obizues
  • 1,473
  • 5
  • 16
  • 30