【问题标题】:after installing ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated my android built not working安装 ionic cordova 插件后添加 cordova-plugin-fcm-with-dependecy-updated 我的 android 构建不工作
【发布时间】:2019-05-10 04:41:25
【问题描述】:

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

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

我想要 ionic 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-framework cordova-plugin-proguard


    【解决方案1】:

    试试这个!..

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

    第三步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
    

    【讨论】:

    • 先生上述解决方案已修复,但生成另一个错误:FirebaseInstanceId.getInstance().getInstanceId()
    【解决方案2】:

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

    答案: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 官方 repo 中打开了一个 pull request 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

    【讨论】:

    • 感谢您的帮助,尝试了您的解决方案仍然相同的错误发现 com.google.firebase:firebase-core:16.0.8,但 google-services 插件需要版本 10.+。找到 com.google.firebase:firebase-messaging:17.5.0,但 google-services 插件需要 10.+ 版本。找到 com.google.android.gms:play-services-auth:+,但 google-services 插件需要 10.+ 版本。找到 com.google.android.gms:play-services-identity:+,但 google-services 插件需要 10.+ 版本。
    【解决方案3】:

    我是与 Cordova 一起开发的韩国人

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

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

    我不确定内容是否会使用 Google 翻译提供。 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

    【讨论】:

      猜你喜欢
      • 2020-10-17
      • 2021-01-19
      • 1970-01-01
      • 2021-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-15
      • 2019-09-03
      相关资源
      最近更新 更多