连接到 google 播放服务时出现异常 null

exception while connecting to google play services null

我正在尝试使用 https://github.com/googlesamples/android-fit 和 android studio 实现 google 适合 API,但出现以下错误:

 exception while connecting to google play services null

我已经通过提供包名称在 google 开发人员控制台中设置了 OAUTH,并为我的构建设置了 SSH。而且我还启用了 API。

我似乎无法弄清楚我还需要做什么才能成功连接到 Google 播放...

我没用过Android-fit,但是在我的项目中用过Google play Location services。因此,步骤是首先检查播放服务是否存在。如果方法 returns 为真,则连接到该服务。然后在连接建立的回调方法中实现你的逻辑。如果它们不存在,则重定向用户以从 Playstore 获取它们。假设该设备没有 google Play 商店,然后将它们重定向到 Web Url 以下载它。