cannot resolve symbol 'AuthUI' in version 4.0.1

Viewed 456

I've followed the introduction of Firebase, but it seems there is something wrong with my build.gradle.

Code of MainActivity

public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user !=null){
                // user is signed in
            }else {
                //user is signed out
                startActivityForResult(
                        AuthUI.getInstance()
                                .createSignInIntentBuilder()
                                .setAvailableProviders(Arrays.asList(
                                        new AuthUI.IdpConfig.GoogleBuilder().build(),
                                        new AuthUI.IdpConfig.FacebookBuilder().build(),
                                        new AuthUI.IdpConfig.TwitterBuilder().build(),
                                        new AuthUI.IdpConfig.GitHubBuilder().build(),
                                        new AuthUI.IdpConfig.EmailBuilder().build(),
                                        new AuthUI.IdpConfig.PhoneBuilder().build()))
                                .build(),
                        RC_SIGN_IN);
            }
        }

Code of Build.gradle

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

compile 'com.android.support:design:26.0.+'
//24.2.0
compile 'com.android.support:appcompat-v7:26.0.+'
//v7:24.2.+

// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'


//FireBase Dependency
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
// 27.0.3
defaultConfig {
    applicationId "com.google.firebase.udacity.friendlychat"
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"

}
defaultConfig {
    // ...
    resConfigs "en" // And any other languages you support
}
implementation 'com.google.firebase:firebase-core:16.0.1'
compile 'com.google.firebase:firebase-database:16.0.1'
compile 'com.google.firebase:firebase-auth:16.0.1'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.firebase:firebase-firestore:17.0.1'
compile 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
}

I've invalidated cache and restart for several times but it seems didn't help. Are there some other dependencies I've missed?

1 Answers

Hello I believe that you need to include

import com.firebase.ui.auth.AuthUI;

in your MainActivity file

Related