Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android上的gmail身份验证问题_Java_Android_Xml_Authentication - Fatal编程技术网

Java Android上的gmail身份验证问题

Java Android上的gmail身份验证问题,java,android,xml,authentication,Java,Android,Xml,Authentication,无法在Android上通过Google验证。Android Studio显示以下错误: 无法实例化以下类: com.google.android.gms.common.SignInButton 这是我的XML <com.google.android.gms.common.SignInButton android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_h

无法在Android上通过Google验证。Android Studio显示以下错误: 无法实例化以下类:

com.google.android.gms.common.SignInButton
这是我的XML

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

我认为您没有添加play services auth的依赖项

只需在
build.gradle
应用程序文件中添加compile
'com.google.android.gms:play services auth:11.4.0'
依赖项

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services-auth:11.4.0'
}

是否在项目级别的build.gradle文件中添加了依赖项?如果没有,则在该列表中添加以下依赖项

dependencies{
    classpath 'com.google.gms:google-services:3.0.0'
    ...
}

添加带问题的
build.gradle
文件我已经添加了它,先生,但渲染仍然显示相同的消息。尝试清理重建您的项目@abdellahamadanalready添加:compile'com.google.android.gms:play services auth:11.4.0'@NileshRathod我已经清理并重建了项目。我不知道问题出在哪里。谢谢你的帮助。@NileshRathod是的,我仍然有同样的错误。我已经添加了所有依赖项,但没有添加任何依赖项。我的项目依赖项有:classpath'com.google.gms:googleservices:3.1.0'非常感谢。上述答案解决了这个问题。
dependencies{
    classpath 'com.google.gms:google-services:3.0.0'
    ...
}