'com.google.android.gms.common.SignInButton button not displaying in design using Firebase
Connected Firebase with my Android project and here is my build.gradle
file code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.seyali_01.firebasegooglein"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
In my activity_main.xml this is the code
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.seyali_01.firebasegooglein.MainActivity"
android:background="@drawable/batman">
<com.google.android.gms.common.SignInButton
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</com.google.android.gms.common.SignInButton>
</android.support.constraint.ConstraintLayout>
Trying for google-sign-in
in my project using Firebase but the default google-signIn
button not displaying after adding the above code but it not showing any error in the xml file. Kindly help me to sort out this problem as i'm new to this platform.
I just want to know if the error comes because of ConstraintLayout
or mistakes in gradle files kindly help me. Thanks in advance.
Solution 1:[1]
Seems this error is due to the bug in Android Studio,
Try this: Restart your Android-studio and click File from Menu bar and choose invalidate caches / restart.
Hope this will work for you.
Solution 2:[2]
It seems the error is because of the fact that you haven't added the required constraints to that button. Try adding constraints.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Maniraj Murugan |
Solution 2 | Dharman |