I’m not sure what’s going on here, I pulled my recently updated repo and every time I open the app to debug it on an emulator I get E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED as the app loads up the main screen. However this hadn’t happened before today so I don’t know what could’ve changed? I deleted the app from the Firebase console and re-added it (through Firebase Assistant), but that didn’t fix it either? I’ve included my build.grade file but I’m not sure what else I need to be looking at, any assistance would be appreciated.

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.android.projectrc"
        minSdkVersion 16
        targetSdkVersion 27
        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 'com.wdullaer:materialdatetimepicker:3.4.0'
    implementation "org.jetbrains.anko:anko:$anko_version"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.github.bumptech.glide:glide:4.2.0'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}








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

2

The problem in my case was that the emulator was not connected to internet, seems that is not implicitly connected like the ios simulator.

Using an emulator WITHOUT Google Play will cause this error.

1

Check if you have internet connection in your emulator. I had the same issue and running emulator like this helped me:

emulator -avd <Avd name> -dns-server 8.8.8.8

My guess is that a new version of the Google Play library has been released and your test device/emulator need update its currently installed version.

Check the Google Play Store app on your device/emulator, make the update, and you should be good to go !

Cold Boot Device Solved for Android Emulator

1

I faced the same same problem. I was using a Nexus with API 28 and it was buggy and I couldn’t update the Google Play.

I had to create another simulator with the API 24 and update the Google Play from the simulator. Now, the email auth and firestore works, but the Facebook and Google login doesn’t work despite it works on ios.

1

I faced the same problem.And the first time I used a Nexus with API 28.

Android Studio prompted me to say that "2019-06-06 09:16:04.540 4415-4502/com.google.android.youtube E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED".

Finally,I uninstalled the simulator and install a new Nexus with API 26.The problem was finally solved.

1

I was able to resolve mine by wiping the emulator data in the android studio. You can try this.

Also, my emulator was a Pixel 4 with API 31

1

go to Project -> Dockerfile -> download your emulator Api (Api – 28) version on the basis of sdkmanager ‘platforms;android-28’. enter image description here