csantos
csantos

Reputation: 187

Error when cordova launch my app

I have a big problem. I execute the comand ionic cordova run android and all is OK. The build is success, however, when the app is launching, the app throw a message'Unfortunately, app has stopped.' I have tried to see the logcat with adb locgat and the error is that:

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process
Make sure to call FirebaseApp.initializeApp(Context) first.

I have never seen that error before and my app is the same, i have changed anything. Please, could someone help me? Thank you.

*The command ionic serve works fine.

Upvotes: 1

Views: 546

Answers (1)

Prithivi Raj
Prithivi Raj

Reputation: 2736

Please make sure to Download your Firebase configuration files, GoogleService-Info.plist for ios and google-services.json for android, and place them in the root folder of your cordova project

- My Project/
    platforms/
    plugins/
    www/
    config.xml
    google-services.json       <--
    GoogleService-Info.plist   <--
    ...

See https://support.google.com/firebase/answer/7015592 for details how to download the files from firebase.

Issue is resolved with this link. Below is the extract from that link

Follow this steps.

Inside the platforms folder, android/src/{package name}/MainActivity.java

Import the firebase library,

import com.google.firebase.FirebaseApp; Inside the oncreate method, below super.oncreate(savedinstancestate),

Add FirebaseApp.initializeApp(this);

Last step,

Inside the platforms folder, android/res/values/string.xml,

Add ***

*** can be found in the googleservice.json file "client": [ { "client_info": { "mobilesdk_app_id": this value

Upvotes: 1

Related Questions