Error inflating class com.google.android.gms.common.SignInButton

I have a button of Google Sign-in, and I don't know how fix it :(

the error is when pass setContentView(R.layout.activity_login); the class is a Activity and implements this:

  public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor>, Responser<User>,
        GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener

I don't know where is the error, but after it was okay :(, could somebody help me please?

This is the Gradles
app:
 apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "es.iesnervion.qa"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        //AÑADIDO PARA JAVA 8
        jackOptions {
            enabled true
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    buildTypes {
        lease {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:design:25.1.0'
    //For CardViews and RecyclerViews
    //Retrofit
    //For animations


    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:cardview-v7:25.0.1'
    compile 'com.android.support:recyclerview-v7:25.0.1'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.github.lzyzsd:circleprogress:1.2.1'
    compile 'org.apache.ant:ant:1.7.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'org.testng:testng:6.9.6'
    testCompile 'junit:junit:4.12'
    compile project(path: ':libraries:BaseGameUtils')

}
BaseGameUtils
apply plugin: 'com.android.library'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
    }
}

dependencies {
    // Set defaults so that BaseGameUtils can be used outside of BasicSamples
    if (!project.hasProperty('appcompat_library_version')) {
        ext.appcompat_library_version = '20.0.+'
    }
    if (!project.hasProperty('support_library_version')) {
        ext.support_library_version = '20.0.+'
    }
    if (!project.hasProperty('gms_library_version')) {
        ext.gms_library_version = '8.4.0'
    }

    compile "com.android.support:appcompat-v7:${appcompat_library_version}"
    compile "com.android.support:support-v4:${support_library_version}"
    compile "com.google.android.gms:play-services-games:${gms_library_version}"
    compile "com.google.android.gms:play-services-auth:${gms_library_version}"
    compile "com.google.android.gms:play-services-plus:${gms_library_version}"
}

android {
    // Set defaults so that BaseGameUtils can be used outside of BasicSamples
    if (!project.hasProperty('android_compile_version')) {
        ext.android_compile_version = 23
    }
    if (!project.hasProperty('android_min_version')) {
        ext.android_min_version = 15
    }
    if (!project.hasProperty('android_version')) {
        ext.build_tools_version = "23.0.2"
    }

    // Set defaults so that BaseGameUtils can be used outside of BasicSamples
    if (!project.hasProperty('android_min_sdk_version')) {
        ext.android_min_sdk_version = 9
    }

    compileSdkVersion android_compile_version
    buildToolsVersion '25.0.0'

    defaultConfig {
        minSdkVersion android_min_version
        targetSdkVersion android_compile_version
    }
}
Activity login
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/loginId"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:gravity="center_horizontal"
    android:noHistory="true"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="@color/colorBackground"
    tools:context="es.iesnervion.qa.ui.View.LoginActivity">

    <!-- Login progress -->
    <ProgressBar
        android:id="@+id/login_progress"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:visibility="gone" />

        <LinearLayout
            android:id="@+id/login_form"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:weightSum="1">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/logo"
                android:maxHeight="200dp"
                android:src="@drawable/logo_big"
                android:adjustViewBounds="true"
                android:layout_gravity="center"/>

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/prueba">

                <AutoCompleteTextView
                    android:id="@+id/email"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/prompt_email"
                    android:inputType="textEmailAddress"
                    android:maxLines="1"
                    android:minLines="1" />

            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <EditText
                    android:id="@+id/password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/prompt_password"
                    android:imeActionId="@+id/login"
                    android:imeActionLabel="@string/action_sign_in_short"
                    android:imeOptions="actionUnspecified"
                    android:inputType="textPassword"
                    android:maxLines="1"
                    android:minLines="1" />

            </android.support.design.widget.TextInputLayout>

            <Button
                android:id="@+id/email_sign_in_button"
                style="?android:textAppearanceSmall"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:layout_marginTop="16dp"
                android:text="@string/action_sign_in"
                android:textStyle="bold" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="10dp"
                android:text="Ó"
                android:textColor="@color/colorPrimary"
                android:textAlignment="center" />

            <!-- sign-in button -->
            <com.google.android.gms.common.SignInButton
                android:id="@+id/google_sign_in_button"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </LinearLayout>

</LinearLayout>

This is the trace:

FATAL EXCEPTION: main
                                                                Process: es.iesnervion.qa, PID: 5133
                                                                java.lang.RuntimeException: Unable to start activity ComponentInfo{es.iesnervion.qa/es.iesnervion.qa.ui.View.LoginActivity}: android.view.InflateException: Binary XML file line #101: Binary XML file line #101: Error inflating class com.google.android.gms.common.SignInButton
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:158)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                 Caused by: android.view.InflateException: Binary XML file line #101: Binary XML file line #101: Error inflating class com.google.android.gms.common.SignInButton
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116)
                                                                    at android.app.Activity.performCreate(Activity.java:6876)
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                 Caused by: android.view.InflateException: Binary XML file line #101: Error inflating class com.google.android.gms.common.SignInButton
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:657)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116) 
                                                                    at android.app.Activity.performCreate(Activity.java:6876) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                 Caused by: java.lang.reflect.InvocationTargetException
                                                                    at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116) 
                                                                    at android.app.Activity.performCreate(Activity.java:6876) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                 Caused by: java.lang.NoSuchMethodError: No static method zzac(Ljava/lang/Object;)Lcom/google/android/gms/dynamic/zzd; in class Lcom/google/android/gms/dynamic/zze; or its super classes (declaration of 'com.google.android.gms.dynamic.zze' appears in /data/app/es.iesnervion.qa-1/base.apk)
                                                                    at com.google.android.gms.common.internal.zzae.zzc(Unknown Source)
                                                                    at com.google.android.gms.common.internal.zzae.zzb(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.zzbw(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.setStyle(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.<init>(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.<init>(Unknown Source)
                                                                    at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116) 
                                                                    at android.app.Activity.performCreate(Activity.java:6876) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

Ensure that Google's Maven repository is included in your project's top-level build.gradle file:

allprojects {
    repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must instead use:
        // maven {
        //     url 'https://maven.google.com'
        // }
    }
}

Then declare Google Play services as a dependency, in your app-level build.gradle file:

apply plugin: 'com.android.application'
    ...

    dependencies {
        compile 'com.google.android.gms:play-services-auth:11.8.0'
    }

**PS:**Avoid declaring multiple versions of play services dependencies, this can cause mismatches and consequently generate the bug you're facing.

android.view.InflateException: Binary XML file line #17: Error , InflateException: Binary XML file line #17: Error inflating class fragment # SupportMapFragment" to "class="com.google.android.gms.maps. Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

Just include compile 'com.google.android.gms:play-services:11.0.4' dependency in your build.gradle(app).

Error inflating com.google.android.material.button.MaterialButton , MaterialButton Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.material.button. Error en com.google.android.gms.common.SignInButton. Estoy intentando establecer el inicio de sesión de Google en mi aplicación. Recibo un error en el archivo XML

You must include implementation 'com.google.android.gms:play-services-auth:17.0.0' for google sign in. Because the google-sign in button is used for Google sign purpose. So you should include the dependency for it in your gradle file(app)

InflateException: Binary XML file line #37: Error inflating class , NewLoginActivity}: android.view.InflateException: Binary XML file line #103: Error inflating class com.google.android.gms.common.SignInButton at android.app. at com.google.android.gms.common.SignInButton.onClick(Unknown Source) asif ahmed ok got it..whenever I run my app in a device or emulator ill get “your app wont work google play store need to be updated”,i have updated “Google APIs x86 (Google Inc.) – API Level 19” as target.

Android 4.0 Issue with google plus login, NewLoginActivity}: android.view.InflateException: Binary XML file line #103: Error inflating class com.google.android.gms.common.SignInButton at android.app. Importation de google-play-services lib dans Intellij IDEA 12(et 13) (1) J'aimerais importer (et utiliser) la bibliothèque des services Google Play dans un projet Android existant, mais je me bats avec ce qui doit être un problème de dépendance.

Ошибка в com.google.android.gms.common.SignInButton Oh! Android, MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.google.android.gms.common.SignInButton 10-03 05:17: 46.757:� Импортирование google-play-services lib в Intellij IDEA 12 (и 13) Я хотел бы импортировать (и использовать) библиотеку Служб Google Play в существующий проект Android, но я борюсь с тем, что должно быть проблемой зависимости.

android, NewLoginActivity}: android.view.InflateException: Binary XML file line #103: Error inflating class com.google.android.gms.common.SignInButton at android.app. Importation de la librairie google-play-services dans Intellij IDEA 12 (et 13) Demandé le 31 de Juillet, 2013 Quand la question a-t-elle été 10597 affichage Nombre de visites la question a

Comments
  • did u try gradle sync
  • yeess :(, I will try to restar android studio invalidating the cache :/
  • same issue, it's impossible :(, Could be for this mavenCentral() ?