安装离子Cordova插件后,添加cordova-plugin-fcm-with-dependecy-updated我的Android内置无法正常工作

时间:2019-05-10 04:41:26

标签: ionic-framework

错误:任务':processDebugGoogleServices'的执行失败。

  

请通过更新google-services插件的版本(有关最新版本的信息可在https://bintray.com/android/android-tools/com.google.gms.google-services/上)或将com.google.android.gms的版本更新为10+来解决版本冲突。

我想要离子式的Cordova插件cordova-plugin-fcm-with-dependecy-updated进行通知,但是如果我删除了该插件,则我的应用程序可以正常运行

我尝试将fcm插件与带有cordova-plugin-googleplus 7.0.0的android 8.0.0一起使用,并尝试将android 7.4.1和6.4.0与cordova-plugin-googleplus 5.2.1一起使用

3 个答案:

答案 0 :(得分:0)

我们有同样的问题,昨天我们用以下答案解决了这个问题:

答案:1

这是由于Firebase在4月5日进行了更新。在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

答案:1

一个很棒的人在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.

现在可以使用了。

ref:Page

答案 1 :(得分:0)

尝试一下!..

步骤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

demo 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离子Cordova构建Android

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

答案 2 :(得分:0)

我是与科尔多瓦一起发展的韩国人

我解决如下。 科尔多瓦-插件-Admob-free和 图书馆与cordova-plugin-fcm-with-dependecy-updated冲突。

我仅更改了广告版本并按如下所示运行它。

我不确定是否将使用Google Translate交付内容。 enter image description here

/platforms/android/project.properties

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