登录后,我进入一个循环W / BiChannelGoogleApi:[FirebaseAuth:] getGoogleApiForMethod()返回了Gms:com.google.firebase.auth.api.internal

时间:2019-03-22 09:07:16

标签: android firebase firebase-authentication

我对Firebase身份验证有疑问, 如果我登录,就会陷入导致我麻烦的循环。

当我进入此循环时,与Firebase数据库的连接也被阻止

我不知道它是否可以依赖于依赖项的版本,我放了最新版本。

来自控制台的错误是这些,它们不断出现:

W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73

这是更完整的:

D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-8001407550778259391}]
I/Transaction: runTransaction() usage detected while persistence is enabled. Please be aware that transactions *will not* be persisted across database restarts.  See https://www.firebase.com/docs/android/guide/offline-capabilities.html#section-handling-transactions-offline for more details.
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
D/: HostConnection::get() New Host Connection established 0x9ebc9a40, tid 11532
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
    Activity resumed, time: 173786466
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
D/: HostConnection::get() New Host Connection established 0xa15e8100, tid 11578
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
I/art: Do partial code cache collection, code=29KB, data=31KB
I/art: After code cache collection, code=29KB, data=31KB
    Increasing code cache capacity to 128KB
D/EGL_emulation: eglCreateContext: 0x9ce34aa0: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x9ce34aa0: ver 2 0 (tinfo 0x9ce366f0)
W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
D/EGL_emulation: eglMakeCurrent: 0x9ce34aa0: ver 2 0 (tinfo 0x9ce366f0)
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 4
I/art: Do partial code cache collection, code=49KB, data=59KB
I/art: After code cache collection, code=41KB, data=55KB
I/art: Increasing code cache capacity to 256KB
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
V/FA: Inactivity, disconnecting from the service
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@27d8f73

问题似乎并非立即产生,但是一段时间后,我打开和关闭了该应用程序,但我的印象是,只有在应用程序启动时仍保持登录状态,才会发生此问题,但我不确定。

我认为错误来自的代码是这样的:

public void checkCurrentUser() {
    // [START check_current_user]
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);

    // get menu from navigationView
    Menu menu = navigationView.getMenu();

    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if (user != null) {
        // User is signed in
        menu.findItem(R.id.edit_login).setVisible(false);
        menu.findItem(R.id.edit_logout).setVisible(true);

        if (LoginAmministratore.seiAmministratore(user.getEmail())) {
            menu.findItem(R.id.edit_notizia).setVisible(true);
            menu.findItem(R.id.edit_squadra).setVisible(true);
            menu.findItem(R.id.edit_giocatore).setVisible(true);
            menu.findItem(R.id.edit_calendario).setVisible(true);
        } else {
            menu.findItem(R.id.edit_notizia).setVisible(false);
            menu.findItem(R.id.edit_squadra).setVisible(false);
            menu.findItem(R.id.edit_giocatore).setVisible(false);
            menu.findItem(R.id.edit_calendario).setVisible(false);
        }

    } else {
        // No user is signed in
        menu.findItem(R.id.edit_login).setVisible(true);
        menu.findItem(R.id.edit_logout).setVisible(false);
        menu.findItem(R.id.edit_notizia).setVisible(false);
        menu.findItem(R.id.edit_squadra).setVisible(false);
        menu.findItem(R.id.edit_giocatore).setVisible(false);
        menu.findItem(R.id.edit_calendario).setVisible(false);
    }
    // [END check_current_user]
}

依赖项是这些:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-basement:16.2.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    //implementation 'com.google.firebase:firebase-firestore:18.1.0'
    implementation 'com.google.firebase:firebase-storage:16.1.0'
    implementation 'com.google.firebase:firebase-auth:16.2.0'
    implementation 'com.google.firebase:firebase-messaging:17.4.0'

    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
    implementation 'com.android.support:support-v4:28.0.0'

    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'
    def room_version = "1.1.1"
    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"
    // https://github.com/bumptech/glide
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    // https://www.joda.org/joda-time/
    implementation 'joda-time:joda-time:2.10.1'
    // trova memory leak
    // https://github.com/square/leakcanary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    // Optional, if you use support library fragments:
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
}

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

0 个答案:

没有答案