ReallySmallSoftware / cordova-plugin-firebase-crashlytics

Google Firebase Crashlytics Cordova plugin
Other
33 stars 80 forks source link

Last Version closes my Android App on logException function #45

Closed juliocampossalcedo closed 4 years ago

juliocampossalcedo commented 4 years ago

Expected Behavior

When I call the function logException(message) my android app should send the log to my Crashlytics.

Actual Behavior

When I call the function logException(message) my android app is closed unexpectedly without any log.

Steps to Reproduce the Problem

Just call the method in this way:

import { Injectable } from "@angular/core";
import { FirebaseCrashlytics } from "@ionic-native/firebase-crashlytics/ngx";

@Injectable({
  providedIn: "root",
})
export class LoggerService {
  public static crashlytics: FirebaseCrashlytics;

  constructor() {}

  init() {
    LoggerService.crashlytics = new FirebaseCrashlytics().initialise();    
  }

  logException(errorMessage: string) {
    LoggerService.crashlytics.logException(errorMessage);
  }
}

When I call the method logException of this services, my app is closed.

Specifications

sandu2d commented 4 years ago

Same issue. @juliocampossalcedo do you fixed it?

juliocampossalcedo commented 4 years ago

Same issue. @juliocampossalcedo do you fixed it?

No, I changed of plugin to https://ionicframework.com/docs/native/firebase-crash and it works.

sandu2d commented 4 years ago

@juliocampossalcedo I finally found how to fix it correctly. First of all, cordova-plugin-google-service is depricated and because of it, FirebaseCrashlytics 1.2.0 is not initialized correctly because it can`t find google_api: https://github.com/chemerisuk/cordova-support-google-services So, the solution is to add these lines in config.xml:

<edit-config file="res/values/strings.xml" mode="merge" target="/*"> <string name="google_app_id">1:XXXX:android:YYYY</string> <string name="google_api_key">AAAAA-BBBBB</string> </edit-config>

and:

<preference name="GradlePluginGoogleServicesEnabled" value="true" /> <preference name="GradlePluginGoogleServicesVersion" value="4.2.0" />

Now cordova-android should pe upgraded to 9.0: https://cordova.apache.org/announcements/2020/06/29/cordova-android-9.0.0.html

That`s all. Now FirebaseCrashlytics is working how was expected.