1

I'm following this Udacity tutorial to get the user Lat/Long location values and display these values in a TextView. I'm working through enabling the Maps API for Android, but am getting the error message when running on the emulator (Nexus 6 with Google APIs): getGoogleAppId failed with status: 10 but am not sure how to fix this error.

I've followed the steps in the Google Documentation for Signup and API Keys and here is the app code.

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.trishwhetzel.googlelocationservices" >

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="MY-API-KEY"/>
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

I added the debug fingerprint certificate and app package name to the project in the Google Developers Console that I enabled the Google Maps Android API in order to generate an Android API key.

I created a google-services.json file following the Google Documentation here, with the resulting file below and added this under /app.

google-services.json

{
  "project_info": {
    "project_id": "plwjava",
    "project_number": "339950946077",
    "name": "plwjava"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:339950946077:android:27d689d63f1b7a06",
        "client_id": "android:com.google.samples.quickstart.signin",
        "client_type": 1,
        "android_client_info": {
          "package_name": "com.google.samples.quickstart.signin"
        }
      },
      "oauth_client": [],
      "api_key": [],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "cloud_messaging_service": {
          "status": 2,
          "apns_config": []
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "google_signin_service": {
          "status": 1
        },
        "ads_service": {
          "status": 1
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "1:339950946077:android:e6522183029b3f29",
        "client_id": "android:com.google.android.gms",
        "client_type": 1,
        "android_client_info": {
          "package_name": "com.google.android.gms"
        }
      },
      "oauth_client": [],
      "api_key": [],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "cloud_messaging_service": {
          "status": 2,
          "apns_config": []
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "google_signin_service": {
          "status": 1
        },
        "ads_service": {
          "status": 1
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "1:339950946077:android:11a88aaa174bec42",
        "client_id": "android:com.google.android.gms.maps",
        "client_type": 1,
        "android_client_info": {
          "package_name": "com.google.android.gms.maps"
        }
      },
      "oauth_client": [],
      "api_key": [],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "cloud_messaging_service": {
          "status": 2,
          "apns_config": []
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "google_signin_service": {
          "status": 1
        },
        "ads_service": {
          "status": 1
        }
      }
    }
  ],
  "client_info": [],
  "ARTIFACT_VERSION": "1"
}

Logs:

12-26 15:59:57.112 2485-2485/? I/art: Not late-enabling -Xcheck:jni (already on)
12-26 15:59:57.206 2485-2485/com.trishwhetzel.googlelocationservices W/System: ClassLoader referenced unknown path: /data/app/com.trishwhetzel.googlelocationservices-2/lib/x86
12-26 15:59:57.325 2485-2505/com.trishwhetzel.googlelocationservices I/GMPM: App measurement is starting up
12-26 15:59:57.333 2485-2505/com.trishwhetzel.googlelocationservices E/GMPM: getGoogleAppId failed with status: 10
12-26 15:59:57.364 2485-2505/com.trishwhetzel.googlelocationservices E/GMPM: Uploading is not possible. App measurement disabled
12-26 15:59:57.549 2485-2510/com.trishwhetzel.googlelocationservices D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-26 15:59:57.769 2485-2510/com.trishwhetzel.googlelocationservices I/OpenGLRenderer: Initialized EGL, version 1.4
12-26 15:59:57.837 2485-2510/com.trishwhetzel.googlelocationservices W/EGL_emulation: eglSurfaceAttrib not implemented
12-26 15:59:57.837 2485-2510/com.trishwhetzel.googlelocationservices W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad760360, error=EGL_SUCCESS
tw1742
  • 1,424
  • 4
  • 18
  • 37
  • If you can provide logs it would greatly help. But checking out [other SO inquiries](http://stackoverflow.com/questions/32988640/google-api-key-missing), the issue might be the API key was incorrect. The Google Maps documentation you linked seems to be directly more related to the google-services.json. You can check out the [Getting Started](https://developers.google.com/maps/documentation/android-api/start#obtaining_an_api_key) for a more info and instructions. – adjuremods Dec 26 '15 at 23:38
  • Yeah, I was following "The full process for getting an API key" from the Getting Started page you link to. Logs added into original post now. – tw1742 Dec 27 '15 at 00:10
  • Can you try to use `com.google.android.maps.v2.API_KEY` as the metadata name? The documentation states that its used for backwards compatibility. Hopefully this is the easiest route. Another alternative is to try out other ways to get Google Maps API Key (fast easy way, slightly less fast way) – adjuremods Dec 28 '15 at 03:54
  • Changing the metadata name did not work. – tw1742 Dec 28 '15 at 04:07

0 Answers0