添加
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
进入 app/build.grandle 文件的dependencies
,每次致电FirebaseAuth.getInstance()
时都会发生错误。在添加新的Gradle依赖性之前,每个FirebaseAuth.getInstance()
调用都可以正常工作,并且我也能够从Firebaseadatabase加载数据。IAM执行此教程:firbaseui for Android- auth。我错了?
更新1:将呼叫打入尝试/捕获块不起作用。DeBbuger不会踏入捕获部分。
更新2:错误是什么?答案:我没有错误。LogCat框不打印任何错误消息。另外,我无法通过调试来忽略错误,因为无法达到接管块。
我的app/build.gradle:
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:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
testCompile 'junit:junit:4.12'
//Firebase
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
//FirebaseUI
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile('com.facebook.android:facebook-android-sdk:4.22.1') // Required only if Facebook login support is required
}
apply plugin: 'com.google.gms.google-services'
要解决这个问题,更改此行的代码:
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
确保在gradle上使用正确的版本号进行firebase-ui-auth。您可以阅读官方文档:https://firebase.google.com/docs/android/setup
只需检查兼容性:
FirebaseUI Version Firebase/Play Services Version
2.3.0 11.0.4
如果要使用firebase-ui 2.3.0
,则必须使用firebase 11.0.4
。
使用:
//Firebase
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
//FirebaseUI
compile 'com.firebaseui:firebase-ui-auth:2.3.0'