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.
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.
If the selected answer doesn't work for some ppl, try this. To get the latest google play services for wear is to dl the latest system image ( API 22
as of this post) for the emulator. I was using API 21
previously.
I solved the same case by downgrading the library versions in gradle scripts.
The phone project dependencies initially were
compile 'com.google.android.gms:play-services:9.2.0'
The watch project dependencies are
compile 'com.google.android.support:wearable:2.0.0-alpha1'
compile 'com.google.android.gms:play-services-wearable:9.2.0'
The phone stopped demanding to upgrade something after I have lowered the version from 9.2.0 to 9.0.0 in both cases.
I had this same issue.
I was able to fix it by updating the Android Play services to be the same version on both the Android Mobile and Android Wear devices.
You can check the Android Play services version on your mobile device by going
Settings -> Apps -> Google Play services -- The version should be listed near the top.
Next, go to your Android Wear device and check the Android Play services version. This can be done by going
Settings -> About -> Click on Versions -- The version should be listed
If these versions are not the same, you need to upgrade the lower version to be the same version as the higher one.
First, go to http://www.apkmirror.com/apk/google-inc/google-play-services/ to download the Android Play services APK: make sure to get the same version as your other device - This link contains the downloads and also good information on finding the correct APK for your device.
You can install the APK to your Android Mobile device using this command. The -r (reinstall) is needed if there was a current version of the Google Play services installed on your device.
adb install -r <path to APK>
You can also install the APK directly to your Android Wear device using Bluetooth, if that is the device that needs to be updated. This requires a bit more work.
First, make sure your Wear and Mobile devices are paired. Navigate to the "Android Wear" application on your Mobile device, in the upper left you should see your device with the status connected. Click on the gear and scroll down to the section title "Debugging over Bluetooth". Make sure the settings look like this:
**Debugging over Bluetooth**
Host: disconnected
Target: connected
Next, run these two commands
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
Finally, run this command
adb devices
You should see two devices connected.
**List of devices attached**
localhost:4444 device
"Device Name" device
If you have something that looks like this
**List of devices attached**
localhost:4444 unauthorized
"Device Name" device
You need to enable debugging mode on your Android Wear device. This can be done by going to
Settings->About and pressing the Build Number tab 7 times.
Go back to
Settings->Developer Options, this should have just appeared.
Make sure to turn on both ADB Debugging and Debug over Bluetooth
Finally, now that you have both of your devices attached, you can use this command to install the APK to your Android Wear device
adb -e install -r <path to APK>
Quick note, this will take 10 minutes or so and nothing will appear to be happening. Just have patience and wait. Eventually you will get a response that looks like this:
76 KB/s (18622942 bytes in 238.161s)
pkg: /data/local/tmp/com.google.android.gms_9.2.56_(534- 124593566)-9256534_minAPI20(armeabi-v7a)(240dpi)_apkmirror.com.apk
Success
Once both devices have the same Google Play service versions, you should be good to go. Happy coding!
In my case I was getting the error when compiling against
compile 'com.google.android.gms:play-services:9.8.0"
Upgrading to 10.0.1, fixed it.
I had this issue when was trying to test on android wear emulator running 7.1.1 W play services 10.2.89 . I had my build.gradle dependency set the 11.0.1 in the wear module. The easiest an quickest solution is you try to set the play services version in you build.gradle to equal or less than what you have on you wear device or emulator in my case i set :
compile 'com.google.android.gms:play-services-wearable:10.0.1'
and it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.