【问题标题】:Ionic 3 Build app failed due to addition of Firebase Cloud Messaging plugin由于添加了 Firebase Cloud Messaging 插件,Ionic 3 Build 应用程序失败
【发布时间】:2018-11-08 09:51:59
【问题描述】:

我已经为我的 Ionic 3 应用程序安装了 Firebase Cloud Messaging 插件,并带有推送通知。但是,它突然在安装后导致我出现构建错误。这是我得到的:

错误脚本:

 * Where:
Script 'C:\Users\Kyle Louise Villar\QuickEApp\platforms\android\cordova-plugin- 
fcm\quicke-FCMPlugin.gradle' line: 13

* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin [class 
'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

我刚刚检查了我的 project.properties 文件,但是当我更改以下属性的版本时似乎什么也没发生。

project.properties

target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.system.library.2=com.android.support:customtabs:23.3.0
cordova.system.library.3=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=cordova-plugin-browsertab/quicke-BrowserTab.gradle
cordova.gradle.include.2=cordova-plugin-buildinfo/quicke-BuildInfo.gradle
cordova.system.library.4=com.facebook.android:facebook-android-sdk:4.37.0
cordova.system.library.5=com.google.android.gms:play-services-tagmanager:11.8.0
cordova.gradle.include.3=cordova-plugin-firebase/quicke-build.gradle
cordova.system.library.6=com.google.firebase:firebase-config:11.8.0
cordova.system.library.7=com.google.firebase:firebase-perf:11.8.0
cordova.system.library.8=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.9=com.google.android.gms:play-services-identity:11.8.0
cordova.system.library.10=com.android.support:support-annotations:27.+
cordova.system.library.11=com.android.support:support-v4:24.1.1+
cordova.system.library.12=com.google.firebase:firebase-core:11.8.0
cordova.system.library.13=com.google.firebase:firebase-messaging:11.8.0
cordova.system.library.14=com.google.firebase:firebase-core:11.8.0
cordova.system.library.15=com.google.firebase:firebase-messaging:11.8.0
cordova.gradle.include.4=cordova-plugin-fcm/quicke-FCMPlugin.gradle

在哪里可以找到输入字符串“+”和/或与我安装的插件有任何冲突?

已安装的插件:

cordova-plugin-advanced-http 2.0.1 "Advanced HTTP plugin"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-buildinfo 2.0.2 "BuildInfo"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-customurlscheme 4.3.0 "Custom URL scheme"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-facebook4 3.1.0 "Facebook Connect"
cordova-plugin-fcm 2.1.2 "FCMPlugin"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-googleplus 5.3.2 "Google SignIn"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.2.0 "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"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
cordova-sqlite-storage 2.2.0 "Cordova sqlite storage plugin"
cordova-universal-links-plugin 1.2.1 "Universal Links Plugin"
es6-promise-plugin 4.2.2 "Promise"

【问题讨论】:

    标签: android firebase ionic3 firebase-cloud-messaging cordova-plugin-fcm


    【解决方案1】:

    当在同一个项目中使用多个 firebase 插件时,往往会出现问题,因为每个插件都会使用一个版本的 firebase 库。在 config.xml 中为这两个插件添加一个变量 FCM_VERSION 并确保其版本相同。例如,

    <plugin name="xxx" spec="~2.2.0">
        <variable name="FCM_VERSION" value="15.0.0" />
    </plugin>
    

    【讨论】:

    • 好的@delwyn-pinto 我尝试将此代码添加到我的config.xml,但在我重建它之后,发生了同样的错误。
    • 好的。然后是 GMS 版本控制问题。卸载插件,并在重新安装时将--variable GMS_VERSION=11.6.2 附加到cordova 插件命令。如果您需要的版本号不同,安装时会显示在控制台日志中。
    猜你喜欢
    • 2018-08-23
    • 2018-06-07
    • 1970-01-01
    • 2019-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-14
    • 2018-12-26
    相关资源
    最近更新 更多