安装 ionic cordova 插件后添加 cordova-plugin-fcm-with-dependecy-updated 我的 android build not working

after installing ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated my android built not working

错误:任务“:processDebugGoogleServices”执行失败。

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.+.

我想要 ionic cordova 插件 cordova-plugin-fcm-with-dependecy-updated 用于通知,但是安装此插件后构建崩溃,如果我删除此插件然后我的应用程序正在运行

我尝试在 android 8.0.0 和 cordova-plugin-googleplus 7.0.0 中使用 fcm 插件,我尝试在 android 7.4.1 和 6.4.0 中使用 cordova-plugin-谷歌加 5.2.1

我们遇到了同样的问题,昨天我们用这个答案解决了这个问题:

答案:1

这是由于 4 月 5 日的 firebase 更新。在这里 https://firebase.google.com/support/release-notes/android#update_-_april_02_2019,我找到了最后的工作版本并相应地调整了我的 project.properties

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

此处所有依赖项都锁定到特定版本(更新 - 2019 年 4 月 2 日)而不是 +,这将使您获得最新版本,从而中断构建过程。

现在可以搭建成功了!希望对您有所帮助!

参考:page

答案:2

一个很棒的人在 cordova-firebase-plugin 官方回购中打开了拉取请求 31,它有效。

我做的步骤:

1 - Remove cordova-firebase-plugin with ionic cordova plugin remove cordova- 
firebase-plugin

2 - Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

3 - rm -rf node_modules/ plugins/ platforms/android package-lock.json

4 - ionic cordova platform add android && npm install

5 - In my case, I also use a firebase js library in an old version because the newest ones are not working for me. With that library I always need to reinstall it manually after all the previous steps, so also I did: npm install firebase@4.12.1.

现在可以使用了。

参考:Page

试试这个!..

步骤 1 ionic cordova platform rm android

第 2 步转到 /plugins/cordova-plugin-fcm-with-dependecy-updated/src/android/FCMPlugin.gradle

像这样改变

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.+'
        classpath 'com.google.gms:google-services:3.1.+'
    }
}
repositories {
    mavenCentral()
    jcenter()
}
dependencies {
    compile 'com.google.firebase:firebase-core:11.4.2'
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

步骤 3 ionic cordova platform add android

步骤 4 转到 /platforms/android/project.properties

像数字一样改成11.4.2

cordova.system.library.3=com.google.firebase:firebase-core:11.4.2
cordova.system.library.4=com.google.firebase:firebase-messaging:11.4.2
cordova.system.library.7=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.4.2

演示project.properties文件

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-badge/mobile-badge.gradle
cordova.system.library.2=com.facebook.android:facebook-android-sdk:4.25.0
cordova.system.library.3=com.google.firebase:firebase-core:11.4.2
cordova.system.library.4=com.google.firebase:firebase-messaging:11.4.2
cordova.gradle.include.2=cordova-plugin-fcm-with-dependecy-updated/mobile-FCMPlugin.gradle
cordova.system.library.6=com.android.support:appcompat-v7:25.+
cordova.system.library.7=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.4.2
cordova.gradle.include.3=cordova-plugin-local-notification/mobile-localnotification.gradle
cordova.gradle.include.4=cordova-plugin-telerik-imagepicker/mobile-ignorelinterrors.gradle
cordova.gradle.include.5=cordova-plugin-telerik-imagepicker/mobile-androidtarget.gradle
cordova.gradle.include.6=phonegap-plugin-barcodescanner/mobile-barcodescanner.gradle
cordova.system.library.11=com.android.support:support-v4:27.+
cordova.gradle.include.7=twitter-connect-plugin/mobile-twitter.gradle
cordova.system.library.12=com.squareup.okhttp3:okhttp:3.12.0

步骤 5 ionic cordova 构建 android

Note :: Don't forgot to add google-services.json file in root directory, main_project/google-services.json

我是韩国人,用Cordova开发

我解决如下。 cordova-plugin-admob-free 和 库与 cordova-plugin-fcm-with-dependecy-updated 冲突。

我只更改了广告版本 运行 如下所示。

我不确定内容是否会使用 Google T运行slate 传送。 enter image description here

/platforms/android/project.属性

cordova.system.library.1=com.google.firebase:firebase-core:16.0.9 cordova.system.library.2=com.google.firebase:firebase-messaging:18.0.0 cordova.gradle.include.1=cordova-plugin-fcm-with-dependecy-updated/helloworld-FCMPlugin.gradle cordova.system.library.3=com.google.android.gms:play-services-base:11.0.4 cordova.system.library.4=com.google.android.gms:play-services-ads:17.0.0