firebaseui - 无法解析版本 4.0.1 中的符号 'AuthUI'

标签 firebaseui

我已经关注了 Firebase 的介绍,但是我的 build.gradle 似乎有问题。

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);
            }
        }

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'
}

我已经多次使缓存无效并重新启动,但似乎没有帮助。 我是否遗漏了其他一些依赖项?

最佳答案

你好,我相信你需要包括

import com.firebase.ui.auth.AuthUI;

在您的 MainActivity 文件中

关于firebaseui - 无法解析版本 4.0.1 中的符号 'AuthUI',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52233055/

相关文章:

android - 升级到 FirebaseUI 3.0 后无法使用 FirebaseRecyclerOptions 检索数据

android - firebase 电话身份验证失败并出现 MISSING_CLIENT_IDENTIFIER

android - Firebase android 如何防止 FirebaseRecyclerAdapter 自动更新?

android - firebaserecycleradapter() 不能应用于 FirebaseRecyclerAdapter

ios - 每次将 child 添加到 firebase 数据库时都会调用 viewDidLoad

ios - 将 .removeStateDidListener 添加到 deinit 会导致应用程序崩溃

android - 如何检索 firebase 中的数据?

java - 警告 :com. firebase.ui.auth.util.ui.FlowUtils

android - 如何按升序对 Firebase 键进行排序?

swift - firebaseui ios : don't show email sign in option