1
我在Andriod的工作室开发,与我创建像这样GoogleApiClient的一个实例:无法连接到GoogleApiClient因错误代码:SERVICE_VERSION_UPDATE_REQUIRED
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 >_<");
}
}
每次执行此活动,我都会收到错误代码:2 = SERVICE_VERSION_UPDATE_REQUIRED
要解决此问题,我安装了Google Play Service revisi在android studio上29.0.0,我确信我的模拟器有API23。不过,我仍然收到这个错误。
我不知道该怎么办,我怎么能更新我的模拟器上的谷歌播放服务?我的代码有问题吗?
解决方法:
感谢暗示2.0模拟器!这是我发现解决(排序)这个问题的另一种方式:
由于在模拟器上更新谷歌播放服务非常困难,我们可以在谷歌服务的gradle依赖项中将版本降低到1.5
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.google.gms:google-services:1.5.0-beta1'
}
及用途::
compile 'com.google.android.gms:play-services:8.1.0'
这不但是建议,当我们构建项目的3.0β1的。
非常感谢您! – user3685578
如果这可以帮助您,请将其标记为已接受的答案,这样可以帮助其他人使用相同的问题 –
如何升级到v2.0? – feresr