skip to Main Content

2023-09-23 12:16:25.889 22438-22438/com.example.firebaseauth E/le.firebaseauth: Attempt to load writable dex file: /data/data/com.example.firebaseauth/code_cache/.overlay/base.apk/classes3.dex
2023-09-23 12:16:28.948 22438-22438/com.example.firebaseauth E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.firebaseauth, PID: 22438
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.firebaseauth/com.example.firebaseauth.login}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.firebaseauth. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3782)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.firebaseauth. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(FirebaseApp.java:179)
at com.google.firebase.auth.FirebaseAuth.getInstance(com.google.firebase:firebase-auth@@22.1.2:1)
at com.example.firebaseauth.login.onCreate(login.java:47)
at android.app.Activity.performCreate(Activity.java:8595)
at android.app.Activity.performCreate(Activity.java:8573)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3764)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:205) 
at android.os.Looper.loop(Looper.java:294) 
at android.app.ActivityThread.main(ActivityThread.java:8177) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 

tried all the versions of dependencies also.

2

Answers


  1. The error message you’ve posted indicates that there is an issue with Firebase initialization in your Android application. Specifically, it’s complaining that the Default FirebaseApp is not initialized in your process com.example.firebaseauth, and it suggests that you should call FirebaseApp.initializeApp(Context) first.

    Here are the key points to address this issue:

    Solution:

    1. Firebase Initialization in Kotlin:
      Make sure you have properly initialized Firebase in your Android application. Firebase should be initialized in the onCreate method of your Application class or the first Activity that gets launched.

      import android.app.Application
      import com.google.firebase.FirebaseApp
      
      class MyApplication : Application() {
          override fun onCreate() {
              super.onCreate()
              FirebaseApp.initializeApp(this)
              // Other initialization code if needed.
          }
      }
      
    2. Check Firebase Dependencies in Kotlin:
      Ensure that you have the Firebase SDK dependencies correctly added to your build.gradle file. Here’s an example in Kotlin:

      implementation("com.google.firebase:firebase-auth:22.1.2") // Use your specific version
      implementation("com.google.firebase:firebase-core:22.1.2") // Core Firebase SDK
      // Add other Firebase dependencies if your app uses them.
      
    3. Update Firebase SDK in Kotlin:
      Keep your Firebase SDK up to date. You can check for the latest version of Firebase SDKs and update your dependencies accordingly.

    4. Rebuild and Clean Project in Kotlin:
      Sometimes, issues like this can be resolved by cleaning and rebuilding your project. Go to "Build" > "Clean Project" and then "Build" > "Rebuild Project" in Android Studio.

    5. Check Proguard/R8 Rules in Kotlin:
      If you are using Proguard or R8 for code obfuscation and minification, ensure that you have the necessary rules to keep Firebase classes intact.

    6. Check Application Id in Kotlin:
      Ensure that the application ID in your build.gradle file matches the one registered in your Firebase project. You can find the application ID in your google-services.json file.

    7. Check for Duplicate Initialization in Kotlin:
      Double-check that you’re not calling FirebaseApp.initializeApp(Context) multiple times in your code.

    By addressing these points using Kotlin code, you should be able to resolve the issue and ensure that Firebase is properly initialized in your Android app.

    Login or Signup to reply.
  2. Firebase released version 11.5 to solve this crash

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search