首页 > 解决方案 > 安装 ionic cordova 插件后添加 cordova-plugin-fcm-with-dependecy-updated 我的 android 构建不工作

问题描述

错误:任务“: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用于通知但安装此插件后构建崩溃如果我删除此插件然后我的应用程序正在运行

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

标签: ionic-frameworkcordova-plugin-proguard

解决方案


尝试这个!..

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

演示项目.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

推荐阅读