0

I am using firebase in my android project but when I run the app on real device I am getting the following exception

java.lang.IllegalStateException: FirebaseApp name project already exists! what I have tried I already tried all stackoverflow answer but it did not solve my problem I have tried even the following link as well FirebaseApp name [DEFAULT] already exists

below is my kotlin where I have initialized firebase in my MainActivity.kt kotlin code

override fun onCreate(savedInstanceState: Bundle?) {
        appCommon.initKey(applicationContext)
        val options = FirebaseOptions.Builder()
            .setApplicationId("Application Id") // Required for Analytics.
            .setProjectId("Project Id") // Required for Firebase Installations.
            .setApiKey("Api key") // Required for Auth.
            .build()
        initializeApp(applicationContext, options, "project id")

I want to know where exactly I am making the problem

Edgar
  • 860
  • 1
  • 17
  • 38
  • Is there a specific reason why are you manually initializing Firebase? Firebase should already be initialized once you [add the google-services plugin](https://firebase.google.com/docs/android/setup#add-config-file) to your app. – Rosário Pereira Fernandes Jan 24 '23 at 17:10

1 Answers1

0

I fixed issue I have added a new ssh key from Google cloud console to firebase and I updated the google json api key then it worked

Edgar
  • 860
  • 1
  • 17
  • 38