GoogleApiClient error for Android Wear API needs to be updated, but I'm already updated

I'm trying to set up the Google Wear app, so on my mobile side I am trying to create a GoogleApiClient that uses the Wearable API, but I get a message that I need to update (SERVICE_VERSION_UPDATE_REQUIRED). But my phone is already on the latest version of Google Play Services. I used the standard Studio creation wizard to create the application using the wearing application, and this is my main activity (and I also added a "" to the manifest.

import android.app.Activity; import android.app.Dialog; import android.os.Bundle; import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.Wearable; public class MyActivity extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private GoogleApiClient mGoogleApiClient; private String TAG = "MyApp"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); } @Override protected void onStart() { super.onStart(); mGoogleApiClient.connect(); } @Override //ConnectionCallbacks public void onConnected(Bundle connectionHint) { Log.d(TAG, "Google API Client was connected"); } @Override //ConnectionCallbacks public void onConnectionSuspended(int cause) { Log.d(TAG, "Connection to Google API client was suspended"); } @Override //OnConnectionFailedListener public void onConnectionFailed(ConnectionResult result) { Log.d(TAG, "FAILED TO CONNECT"); Dialog d = GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this, 0); d.show(); } } 
+6
source share
3 answers

I had this problem recently on Eclipse (not sure if this is a problem in Android Studio, but try it if you haven't solved it yet). The only solution I found was to use the old version of the Google Play Services library in my Wear project.

The latest version of the library (today it is 7095000) does not work with an emulator that you can create using Eclipse. So I went back to the older version (version 6587000), and GoogleApiClient now connects just fine.

If you do not have an older version, check out this answer , which refers to several earlier versions. The last thing you can get is version 6171000 ( download link ). He is a little older than the one I have, but it should work.

+1
source

Try updating the Google Play service package from the SDK manager, you may not have the latest version for Android Studio, and updating the package may do the trick

0
source

You also need to update the wear emulator, I also encountered the same problem, and it was fixed after updating my emulator.

0
source

Source: https://habr.com/ru/post/975582/


All Articles