0

Title, I can't add the packages needed to add google sign in

Gradle 4.4, Gradle plugin 3.1.3, Google services 4.0.1

Added Firebase dependencies

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
...
apply plugin: 'com.google.gms.google-services'

downloaded GooglePlayServices SDK as well. I still don't have the SignInButton (get 'SignInButton button cannot resolve')

what am I missing

1 Answer 1

0

There might be some other issue. I think you don't need to add apply plugin: 'com.google.gms.google-services'.

I used the same implementation 'com.google.android.gms:play-services-auth:15.0.1' version just now and I am able to get SignInButton. Below is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 15
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:26.+'
    implementation 'com.android.support:design:26.+'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'

    testImplementation 'junit:junit:4.12'
}

Screenshot from layout xml file:

enter image description here

Can you confirm that you are able to build your project successfully? If not then please make sure your project is built successfully without any error and then try to add SignInButton. You will get it.

For more information, follow this official link : https://developers.google.com/identity/sign-in/android/sign-in

5
  • I can add the google SignInButton in XML, it even shows in design tab and it builds. I can't however use SignInButton type to reference it in java, so it won't build if I try.
    – John
    Jul 4, 2018 at 1:40
  • @John as I mentioned in the first line of my answer, problem is somewhere else. If you don't find any issue in XML layout for SignInButton then there should not be any error in Java as well. By the way, can you add your Java code like how you are trying to call SignInButton there. I am able to build code successfully. Jul 4, 2018 at 1:47
  • OK, I just redid the whole project. It looks like a bug with android studio or a mix up with the packages (was switching versions everywhere). thanks!
    – John
    Jul 4, 2018 at 2:04
  • @John see I told you issue is somewhere else. Jul 4, 2018 at 2:06
  • @John If you think my efforts helped you then please upvote and accept my answer. Jul 4, 2018 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.