首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >FirebaseAuth类现在缺少"getCurrentUser()“方法了吗?

FirebaseAuth类现在缺少"getCurrentUser()“方法了吗?
EN

Stack Overflow用户
提问于 2018-07-20 04:27:50
回答 4查看 2.1K关注 0票数 1

FirebaseUser昨天还运行得很好,但今天早上我打开项目时发现,Firebase类现在没有任何对Firebase类的引用。我找不到getCurrentUser()方法。

不过,类中的Google doc still shows that it exists

我在那个类中的imports

代码语言:javascript
复制
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;

The build.gradle

代码语言:javascript
复制
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'

而且是的:

我在我的build.gradle

  • My应用程序的build.gradle中有apply plugin: 'com.google.gms.google-services' has repositories { google() jcenter() } in it

  • 我有Clean我的项目没有出现错误<

>H121我已经重新启动了code

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

  • getCurrentUser()方法在我的FirebaseAuth类(已导入)中不再存在。它的signInWithCredential(...)signOut()createUserWithEmailAndPassword(...)signInWithEmailAndPassword(...)方法也是如此。
  • isEmailVerified()方法不再存在于我的FirebaseUser类中<

>H138当尝试Make Project时,我收到此错误:现在突出显示为错误D44

我的完整build.gradle

代码语言:javascript
复制
apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.payne.simpletestapp"
        minSdkVersion 16
        targetSdkVersion 27
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:support-vector-drawable:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    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'

    implementation 'org.osmdroid:osmdroid-android:6.0.1'
    implementation 'org.osmdroid:osmdroid-wms:6.0.1'
    implementation 'org.osmdroid:osmdroid-mapsforge:6.0.1'
    implementation 'org.osmdroid:osmdroid-geopackage:6.0.1'
    api 'com.github.MKergall:osmbonuspack:6.5.1'


    implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
    api 'org.apache.httpcomponents:httpclient-android:4.3.5'

    implementation 'com.squareup.picasso:picasso:2.71828'

    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.6'


}

repositories {
    maven {
        url 'https://repo.spring.io/libs-milestone'
    }
}

apply plugin: 'com.google.gms.google-services'

请帮帮忙?我花了几天的时间构建这个类,现在它不能工作了。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2018-09-04 15:29:56

build.gradle中删除firebase-admin并按Sync now键解决了问题!

感谢BobSnyder (在评论中)。

票数 4
EN

Stack Overflow用户

发布于 2018-07-20 04:29:17

该方法仍然存在。Android Studio可能搞混了,可能是因为你的项目.idea文件夹中的某些东西被破坏了。

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

票数 0
EN

Stack Overflow用户

发布于 2018-07-20 04:55:22

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51431194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档