Why I insert implementation ‘com.google.firebase:firebase-admin:6.13.0’ into gradle, then Firebase.auth.currentUser become invalid?

Why I insert implementation 'com.google.firebase:firebase-admin:6.13.0' into gradle, then val user = Firebase.auth.currentUser which .currentUser become invalid?

Before import implementation 'com.google.firebase:firebase-admin:6.13.0' enter image description here

After import implementation 'com.google.firebase:firebase-admin:6.13.0',auth’s method become admin’s method. It seems Firebase-admin conflicts with FirebaseAuth. Why??

enter image description here

build.gradle(Module:app)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions' apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 30
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.squall.searchdesigner"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    dataBinding {
        enabled = true
    } }

dependencies {
    implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha03'
    def room_version = "2.2.5"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-auth-ktx:19.3.1'
    implementation 'com.google.firebase:firebase-firestore:21.4.3'
    implementation 'com.google.firebase:firebase-storage:19.1.1'
    // FirebaseUI for Cloud Firestore
    implementation 'com.firebaseui:firebase-ui-firestore:6.1.0'
    // FirebaseUI for Firebase Auth
    implementation 'com.firebaseui:firebase-ui-auth:6.2.1'
    // FirebaseUI for Cloud Storage
    implementation 'com.firebaseui:firebase-ui-storage:6.1.0'
    implementation 'com.facebook.android:facebook-login:5.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    //lifecycle
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0"

    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
    //navigation
    implementation "androidx.navigation:navigation-fragment-ktx:2.2.2"
    implementation "androidx.navigation:navigation-ui-ktx:2.2.2"
    //Firebase cloud message
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-messaging-directboot:20.2.0'

    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.material:material:1.1.0'
    //Room
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    // For Kotlin use kapt instead of annotationProcessor
    // optional - Kotlin Extensions and Coroutines support for Room
    implementation "androidx.room:room-ktx:$room_version"
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'jp.wasabeef:picasso-transformations:2.2.1'

    //coroutine
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'

    //Firebase Coroutine dependency:
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.6'
    //Firebase firestore extension
    implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'

    implementation 'androidx.activity:activity-ktx:1.1.0'
    implementation 'androidx.fragment:fragment-ktx:1.2.5'
    //Facebook SDK
    implementation 'com.facebook.android:facebook-android-sdk:5.0.0'

    implementation 'com.google.firebase:firebase-admin:6.13.0'

    implementation 'com.google.firebase:firebase-functions-ktx:19.0.2' }

build.gradle(Project:)

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Answer

CurrentUser only exists in the Firebase Android SDK. You cannot use both Android SDK and Admin SDK together. They have conflicting packages/classes. Specifically, you cannot use the Admin SDK in an Android or any client-side application.