问题
I have an Android Wear app which was working fine on my Moto360. It access Google Play Services and GCM APIs in the Google Admin console. Then I tried to use another watch (LG G Watch). Because I can only pair one watch at any time with my phone, I had to "forget" the moto360 in order to pair with the LG G Watch. Now I cannot seem to connect to Google App API (GCM or play services). I am getting the following error:
I/GMPM ( 2746): App measurement is starting up
E/GMPM ( 2746): getGoogleAppId failed with status: 10
E/GMPM ( 2746): Uploading is not possible. App measurement disabled
This error occurs in the logcat of both the watch and the accompanying mobile app. I tried looking up what the status code but could not find any info. Could anyone please help in gleaning what this status code mean?
回答1:
Replace addApi
with addApiIfAvailable
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApiIfAvailable(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
回答2:
I had the same problem with google's geofencing example. It was caused by location and wearable API version mismatch as you can see below.
dependencies {
compile "com.android.support:support-v4:23.0.0"
compile "com.android.support:support-v13:23.0.0"
compile "com.android.support:cardview-v7:23.0.0"
compile 'com.google.android.gms:play-services-location:7.3.0'
compile 'com.google.android.gms:play-services-wearable:7.8.0'
compile 'com.android.support:support-v13:23.0.1'
wearApp project(':Wearable')
}
Verify your build.grade to check version of API in use.
回答3:
I was with same error, it was resolved with in the instantiation of Client doing:
GoogleApiClient mGoogleClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
And be sure of override this classes:
@Override
protected void onStart(){
super.onStart();
if (!mResolvingError) { // more about this later
mGoogleClient.connect();
}
}
@Override
protected void onStop(){
mGoogleClient.disconnect();
super.onStop();
}
@Override
public void onConnected(Bundle bundle) {
Log.d(TAG, "Connected");
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.d(TAG, "Failed to connect");
}
I used Log.d to test the connection.
来源:https://stackoverflow.com/questions/32812305/android-wear-app-resulting-in-getgoogleappid-failed-with-status-error