Search code examples
ionic-frameworkcordova-plugin-proguard

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


Error: Execution failed for task ':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.+.

i want ionic cordova plugin cordova-plugin-fcm-with-dependecy-updated for notification but build is crash after installed this plugin if i remove this plugin then my app is working

i try to use fcm plugin with android 8.0.0 with cordova-plugin-googleplus 7.0.0 and i try with android 7.4.1 and 6.4.0 with cordova-plugin-googleplus 5.2.1


Solution

  • try this!..

    step 1 ionic cordova platform rm android

    step 2 go to /plugins/cordova-plugin-fcm-with-dependecy-updated/src/android/FCMPlugin.gradle

    change like this

    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
    

    step 3 ionic cordova platform add android

    step 4 Goto /platforms/android/project.properties

    Change like the numbers into 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 file

    # 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
    

    step 5 ionic cordova build android

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