FirebaseAuth类现在缺少“ getCurrentUser()”方法吗?

时间:2018-07-19 20:27:50

标签: java android firebase google-api firebase-authentication

Firebase过去昨天工作正常,但是今天早晨我打开了项目,只是发现FirebaseAuth类现在没有对FirebaseUser类的引用。我找不到getCurrentUser()方法。

不过,班上的Google doc still shows that it exists

method removed?!

我在该课程中的imports

import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GetTokenResult;
import com.google.firebase.auth.GoogleAuthProvider;

build.gradle

api 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.firebase:firebase-admin:6.3.0'

是的:

  • 我的apply plugin: 'com.google.gms.google-services'中有build.gradle
  • 我的应用build.gradle中有repositories { google() jcenter() }
  • 我有Clean个项目而没有出错
  • 我已经重新启动AndroidStudio

我的应用程序中的当前错误(似乎从昨天开始就出现了)

  • getCurrentUser()类(已导入)中不再存在FirebaseAuth方法。与其signInWithCredential(...)signOut()createUserWithEmailAndPassword(...)signInWithEmailAndPassword(...)方法相同。
  • isEmailVerified()类中不再存在FirebaseUser方法了
  • 尝试进行Make Project时,出现以下错误:Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. - auto-value-1.4.jar (com.google.auto.value:auto-value:1.4) Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future. See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
  • build.gradle的{​​{1}}现在突出显示为错误(implementation 'com.android.support:appcompat-v7:27.1.1'

我的完整All com.android.support librairies must have the same version specification

build.gradle

请帮助?我花了几天的时间来建立这堂课,但现在却行不通。

4 个答案:

答案 0 :(得分:2)

firebase-admin中移除build.gradle并按Sync now解决了这个问题!

感谢BobSnyder(在评论中)。

答案 1 :(得分:0)

该方法仍然存在。 Android Studio可能会感到困惑,可能是因为您的项目.idea文件夹中的某些内容已损坏。

尝试退出Android Studio,删除项目根目录下的.idea文件夹,然后将项目再次导入Android Studio。

答案 2 :(得分:0)

转到File-> Invalidate caches and restart菜单。

答案 3 :(得分:-1)

该方法稍加修改即可。

尝试使用它 FirebaseUser用户= FirebaseAuth.getInstance()。getCurrentUser();

相关问题