java - 如何添加按钮 Google+ 登录?

标签 java android google-plus google-plus-signin

我在SDK中安装了Google Play Services,然后在其'Layout'按钮代码中添加了Google

    <com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

有一个错误:

Rendering Problems The following classes could not be found:
- com.google.android.gms.common.SignInButton (Fix Build Path, Create Class)
 Tip: Try to build the project.

我在我的构建文件中添加一行:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])


--> compile 'com.google.android.gms:play-services-ads:8.3.0'


testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/bolts-android-1.2.1.jar')
compile files('libs/Parse-1.10.3.jar')
}

但是还是不行。我怎样才能让按钮出现?

最佳答案

您添加了错误的依赖项。您应该为登录按钮添加这个。

compile 'com.google.android.gms:play-services-auth:8.4.0'

关于java - 如何添加按钮 Google+ 登录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34570091/

相关文章:

java - Servlet 映射与 mvc 资源 spring 相关的问题

java - 将请求转发到 Spring MVC 中的另一个 Controller

android - 如何摆脱旧版 Cocos2Dx 项目中的 "deprecated"警告

java - android 如何获取当前的日期和时间

java - SetContentView 不起作用

Android:Intent-Filter 是如何工作的?

google-plus - 使用 Google+ API 在 Google+ Stream 上发帖

javascript - Google Javascript 客户端库 OAUTH 请求离线访问权限,但从未请求过

google-plus - 根据虚荣网址获取Google+企业页面ID

java - org.springframework.web.servlet.PageNotFound noHandlerFound