1

I'm trying to create an Ionic application with firebase native plugin.

First step I create my ionic app : ionic start

Then I add firebase plugin:
ionic cordova plugin add cordova-plugin-firebase npm install @ionic-native/firebase

After that I try to add android platform : ionic cordova build android

And I have this error :

> Task :app:fabricGenerateResourcesDebug FAILED
ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: null. 

My plugin list cordova plugin list :

cordova-plugin-device 2.0.2 "Device"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

If I use android studio, I have the same error : Crashlytics found an invalid API key: null.

So I used this post : Crashlytics found an invalid API key - AndroidStudio build

After that I get this error : error: cannot find symbol class NotificationManagerCompat.
So I have added the dependency implementation 'com.android.support:support-compat:27.+' to builde.gradle of my application.

But I'm still facing 2 errors :

#android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java
error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
required: String
found: String,String
reason: actual and formal argument lists differ in length
#android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java
error: cannot find symbol class FirebaseInstanceIdService
error: method does not override or implement a method from a supertype

How I can get an ionic app working with firebase (firestore, auth and cloud messaging) ?

Thanks for your help.

Shining
  • 425
  • 6
  • 20

1 Answers1

0

I also remember having endless issues with those Firebase related plugins, but I finally managed to make them work with cordova@7.1.0 and cordova-android@6.3.0. If I remember correctly, I solved one of the problems by switching the Gradle version to 4.1.

I have only the cordova-plugin-firebase-authentication plugin and it depends on cordova-support-google-services, which you don't seem to have installed. You should double-check if your plugin requires it.

andreszs
  • 2,896
  • 3
  • 26
  • 34