Android Wear Error ConnectionResult{statusCode=SER

2020-04-03 17:04发布

问题:

I've wanted to make an easy wearable app and connect through the data layer. Everything works fine with the handheld module (using: S5), but the wearable (using: Moto 360) always throw the error:

onConnectionFailed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null}

The play services at the handheld are up-to-date

I've added

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

to both, the handheld, as the wear build.gradle.

The wearable Activity:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
        stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
            @Override
            public void onLayoutInflated(WatchViewStub stub) {
                mTextView = (TextView) stub.findViewById(R.id.text);
            }
        });
        int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
        Log.i(TAG,"Services available: "+ result);
        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
                    @Override
                    public void onConnected(Bundle connectionHint) {
                        Log.d(TAG, "onConnected: " + connectionHint);
                        // Now you can use the Data Layer API
                    }
                    @Override
                    public void onConnectionSuspended(int cause) {
                        Log.d(TAG, "onConnectionSuspended: " + cause);
                    }
                })
                .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
                    @Override
                    public void onConnectionFailed(ConnectionResult result) {
                        Log.d(TAG, "onConnectionFailed: " + result);
                    }
                })
                        // Request access only to the Wearable API
                .addApi(Wearable.API)
                .build();

    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.i(TAG, "==OnStart===");
        mGoogleApiClient.connect();
    }

I've done research, but I couldn't find any working solution.

回答1:

I have a similar problem when I use Google Play Services on ASUS ZenWatch,

In wearable always throw error:

ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null

Google Play services out of date. Requires 7327000 but found 6774534

I found wearable and handheld Google Play Services may be not syncing, I don't know why.

So, check wearable Google Play Services version

Settings -> About -> Software version

And resync apps

Launch Android Wear app -> Click the gear icon -> select your device -> Resync apps

Wait 3-5 minute , check wearable Google Play Services version.

When sync is complete, maybe you can work it.

Hope you understand my broken English.

share|improve this answer|||||