I\'ve spent about three days now trying to solve a java error that\'s stopping me from finishing my chat app! And of course it\'s a firebase error! I\'m new to Android Developin
Add:
apply plugin: 'com.google.gms.google-services'
in your app gradle file
According to the docs:
As said in the docs:
Any FirebaseApp initialization must occur only in the main process of the app. Use of Firebase in processes other than the main process is not supported and will likely cause problems related to resource contention.
you need to initialize it not in the activity.
add an application class to your manifest example:
<applicaton
android:name="MyApplication"
then do this:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
}
and remove the initialization from the activity. You need to initialize it in the application class which is the base class.
You are using both the current Firebase SDK and the legacy SDK, com.firebase:firebase-client-android:2.5.0
, which has been deprecated for more than a year. For new development, there is no reason to use the legacy SDK. Follow the steps the Upgrade Guide to eliminate use of the legacy SDK.
It's also important to use the same version number for all Firebase and Google Play libraries. You have 10.2.0, 10.2.1 and 11.0.4.
I had this issue. I built the generated android project in the platform in android studio then I found the issue and solved this.
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
Ref (for more detail): https://github.com/arnesson/cordova-plugin-firebase/issues/142