skip to Main Content

My Android Studio project was working fine until I updated a plugin accidentally in a pop-up suggestion. After that "Firebase Auth" methods are not working. For example:

fAuth = FirebaseAuth.getInstance();
fUser = fAuth.getCurrentUser();

I get the error "cannot resolve method getCurrentUser in firebaseAuth". Similarly, in the following code:

ref.child(fAuth.getUid()).child("Orders").child(orderId).orderByChild("orderStatus")
            .addValueEventListener(new ValueEventListener() {.....}

I get error "cannot resolve method getUid in firebaseAuth". Following is my build.gradle file.

dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.squareup.picasso:picasso:2.8'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-firestore:24.4.0'
implementation 'com.google.firebase:firebase-auth:21.1.0'
implementation 'com.google.firebase:firebase-admin:9.1.1'
implementation 'androidx.annotation:annotation:1.5.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.firebase:firebase-storage:20.1.0'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
implementation 'com.google.firebase:firebase-messaging:23.1.1'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
implementation 'com.karumi:dexter:6.2.3'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.vanniktech:android-image-cropper:4.5.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.github.p32929:EasiestSqlLibrary:1.0.0.2'
implementation 'com.github.p32929:AndroidEasySQL-Library:1.4.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'com.android.volley:volley:1.2.1'}

I get these errors in my whole project.

2

Answers


  1. Chosen as BEST ANSWER

    I am answering my own question here. I tried many solutions, but then I got to know I had used a wrong dependency.

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

    After I have removed it, my project is working.

    Hope it will help others.


  2. You’re getting the following error:

    cannot resolve method getUid in firebaseAuth

    Most likely at the following line of code:

    ref.child(fAuth.getUid())...
    

    Because the fAuth object is an object of type FirebaseAuth, a class does not contain any method called getUid(). If you need the UID of the authenticated user, you have to call .getCurrentUser() first. In code that would be:

    ref.child(fAuth.getCurrentUser().getUid())...
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search