【问题标题】:cordova plugin firebase compilation issue科尔多瓦插件火力库编译问题
【发布时间】:2019-07-13 09:19:18
【问题描述】:

我正在尝试使用 firebase 原生插件创建一个 Ionic 应用程序。

第一步我创建我的离子应用程序: ionic start

然后我添加firebase插件:
ionic cordova plugin add cordova-plugin-firebase npm install @ionic-native/firebase

之后我尝试添加 android 平台: ionic cordova build android

我有这个错误:

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

我的插件列表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"

如果我使用 android studio,我也会遇到同样的错误: Crashlytics 发现了一个无效的 API 密钥:null。

所以我使用了这个帖子:Crashlytics found an invalid API key - AndroidStudio build

之后我收到此错误:错误:找不到符号类 NotificationManagerCompat。
所以我在我的应用程序的 builde.gradle 中添加了依赖 implementation 'com.android.support:support-compat:27.+'

但我仍然面临 2 个错误:

#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

如何让 ionic 应用与 firebase(firestore、auth 和云消息传递)一起使用?

感谢您的帮助。

【问题讨论】:

    标签: android firebase cordova ionic-framework


    【解决方案1】:

    我还记得那些与 Firebase 相关的插件有无穷无尽的问题,但我终于设法让它们与 cordova@7.1.0cordova-android@6.3.0 一起工作。如果我没记错的话,我通过switching the Gradle version解决了其中一个问题到4.1。

    我只有cordova-plugin-firebase-authentication 插件,它依赖于cordova-support-google-services,您似乎没有安装它。您应该仔细检查您的插件是否需要它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-08
      • 2014-12-29
      • 2015-10-13
      • 1970-01-01
      相关资源
      最近更新 更多