Android 无法连接到GoogleAppClient,原因是错误代码:需要服务\u版本\u更新\u
我正在开发Andriod Studio,我创建了一个GoogleAppClient实例,如下所示:Android 无法连接到GoogleAppClient,原因是错误代码:需要服务\u版本\u更新\u,android,google-play-services,avd,Android,Google Play Services,Avd,我正在开发Andriod Studio,我创建了一个GoogleAppClient实例,如下所示: locationClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API)
locationClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
我有一个onConnectionFailed处理程序,如下所示:
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
if (connectionResult.hasResolution()) {
try {
connectionResult.startResolutionForResult(ACTRequest.this, 6);
} catch (IntentSender.SendIntentException e) {
}
} else {
//Connection failure cannot be resolved
Toast.makeText(getApplicationContext(),
"Unable to connect to Google Service, sorry >_<" + connectionResult.getErrorMessage(), Toast.LENGTH_LONG)
.show();
Log.d("CONNECTION FAIL", connectionResult.getErrorCode() + " Unable to connect to Google Service, sorry >_<");
}
}
和使用:
compile 'com.google.android.gms:play-services:8.1.0'
但是,不建议这样做。若要使用emulator,请使用当前预览中的新emulator 2.0版:若要使用emulator,使用当前正在预览中的新emulator 2.0版:如果这有助于您,请将其标记为已接受的答案,这样它将有助于其他人回答相同的问题您如何升级到v2.0?这已经过时很长时间了。只需安装Android studio 2.x。如果这有助于您,请将其标记为已接受答案,这样它将帮助其他人回答相同的问题:您如何升级到v2.0?这已经过时很长时间了。只需安装AndroidStudio 2.x。
compile 'com.google.android.gms:play-services:8.1.0'