我快疯了,请帮帮我。。我一直在关注教程页面,但没有成功,
- 我从安卓工作室添加了它们
- 我启用了API
- 我得到了带有默认调试密钥库的SHA1
- 我已经创建了一个新的客户端ID,并在凭据部分创建了新的密钥
- 在手机上编译和上传
但似乎什么都不起作用。
我得到了这个愚蠢的错误:连接结果{statusCode=未知状态代码5005,resolution=null}
愚蠢而复杂的开发人员控制台。。
请帮我
今天它起作用了。可能是包装名称错误。
已解决
只需更改包名称。。这是api客户端
private void buildFitnessClient() {
fitnessClient = new GoogleApiClient.Builder(context)
.addApi(Fitness.HISTORY_API)
.addApi(Fitness.SESSIONS_API)
.addScope(new Scope(Scopes.FITNESS_BODY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_NUTRITION_READ_WRITE))
.addConnectionCallbacks(
new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
ReferenceWrapper.getInstance(context)
.setApiClient(fitnessClient);
((OnClientConnectListener) context)
.onclientConnected();
Log.e("Google fit", "connected");
}
@Override
public void onConnectionSuspended(int i) {
}
})
.addOnConnectionFailedListener(
new GoogleApiClient.OnConnectionFailedListener() {
// Called whenever the API client fails to connect.
@Override
public void onConnectionFailed(
ConnectionResult result) {
if (!result.hasResolution()) {
GooglePlayServicesUtil.getErrorDialog(
result.getErrorCode(), context, 0)
.show();
return;
}
if (!authInProgress) {
try {
authInProgress = true;
result.startResolutionForResult(
context,
KeyConstant.REQUEST_OAUTH);
} catch (IntentSender.SendIntentException e) {
}
}
}
}).build();
}