Accepted answer

The real solution is just to move the

apply plugin: 'com.google.gms.google-services'

at the bottom of the (app)build.gradle script and rebuild the project. Works 100%

Accepted answer

Use the same version of firebase and Google play services

compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'

//Remove this dependency
//compile 'com.google.gms:google-services:3.1.1'

//Add this dependency if you need Google play services 
compile 'com.google.android.gms:play-services:11.4.2'
Accepted answer

“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/ 9) or updating the version of com.google.android.gms to 11.6.2.”

Answer

Go to platform/android/build.gradle File
replace
compile “com.google.android.gms:play-services-base:11.0.4”
compile “com.google.android.gms:play-services-ads:11.0.4”
with
compile “com.google.android.gms:play-services-base:15.0.1”
compile “com.google.android.gms:play-services-ads:15.0.1”

Now open platform/android/project.property file And replace
cordova.system.library.1=com.google.android.gms:play-services-base:11.0.4
cordova.system.library.2=com.google.android.gms:play-services-ads:11.0.4
with
cordova.system.library.1=com.google.android.gms:play-services-base:15.0.1
cordova.system.library.2=com.google.android.gms:play-services-ads:15.0.1

Then Reinstall you fcm plugin and run command -> ionic cordova run android


You should delete the line

apply plugin: 'com.google.gms.google-services'

Because apply plugin: 'com.android.application' already has same package.

ad the same issue using ionic Cordova and fixed it by changing the GMS version in platforms/android/project.properties

 "cordova-plugin-google-analytics": {
      "GMS_VERSION": "VERSION_NUMBER_MENTIONED_IN_THE_BUILD_ERROR"

and in platforms/android/android.json

cordova.system.library.6=com.google.android.gms:play-services-analytics: VERSION_NUMBER_MENTIONED_IN_THE_BUILD_ERROR

Please change your project-level build.gradle file in which you have to change your dependencies class path of google-services or build.gradle path.

buildscript {

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}