Android Wear Emulator show Error SERVICE_VERSION_U

2019-07-09 02:22发布

问题:

I am testing android wear app on Wear Emulator and using eclipse to develop.

In wear app there are code as below in onCreate:

mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener()
{
    @Override
    public void onConnectionFailed(ConnectionResult result)
    {
    Log.d(TAG, "onConnectionFailed: " + result);
    }
}).addApi(Wearable.API).build();
mGoogleApiClient.connect();

When I run this on Wear emulator I got error as below:

W/GooglePlayServicesUtil(1809): Google Play services out of date.  Requires 5089000 but found 5077534
D/WearApp(1809): onConnectionFailed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null}

If any one have solution or tips for that then please let me know.

Thanks!

回答1:

I believe I had the same error.

If your build.gradle is:

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

change it to:

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

that's because Google didn't completely roll out the latest play services to devices, but it's already available to developers. As an alternative solution, you can check if there's an update to the WearEmulator on the SDK Manager.



回答2:

If you look in your build.gradle file, you are probably using play-services. You need to use play-services-wearable instead, which has the correct version.

compile 'com.google.android.gms:play-services-wearable:+'

If you are using Eclipse, you need to ensure you unpack the play-services-wearable AAR file and not the standard mobile play-services AAR file.