我正在开发一个应用程序,我想在其中使用 google plus 登录。 我已经按照以下步骤操作 https://developers.google.com/+/mobile/android/sign-in
但是当我尝试使用 google api 示例项目(从 android sdk->extras->google 服务导入)登录 google plus 时 它总是显示“无法与服务器建立可靠的连接”。
我该如何解决? 我正在真实设备上测试示例。
我的logcat如下,
05-17 15:21:56.500: E/GLSUser(6721): Empty consent data
05-17 15:21:56.500: I/GLSUser(6721): GLS error: NetworkError testid.android@gmail.com oauth2:https://www.googleapis.com/auth/plus.login
05-17 15:21:56.500: W/GLSUser(6721): Status from wire: NetworkError status: NETWORK_ERROR
最佳答案
遵循 https://developers.google.com/+/mobile/android/sign-in 处的代码示例时,我也得到了“空同意数据”。
但是在 PlusClient
实例上调用 setScopes()
似乎可以解决问题:
mPlusClient = new PlusClient.Builder(this, this, this)
.setVisibleActivities("http://schemas.google.com/AddActivity")
.setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_PROFILE)
.build();
您是否在代码示例中设置了范围?
关于android - "Can' t 创建到服务器的可靠连接“使用 google plus 登录时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16606155/