Cordova – FCMPLUGIN construction failed due to version conflicts with Google GMS service

I am using Ionic 2. on Windows for Android. When I add the cordova-plugin-fcm plugin, I can no longer build the project. This is the error I get:

< /p>

BUILD FAILED 

Total time: 4.697 secs

Error: cmd: Command failed with exit code 1 Error output: < br />FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (i
nformation 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 9.2.0.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get mor
e log output.

The following is a snippet of my config.xml:


















I have read this and this related posts, it is recommended to add this line to build.gradle (automatically created by ion):

< blockquote>

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

I have tried adding it to build-extras.gradle and No luck.

In my build.graddle, I see this line:

// PLUGIN GRADLE EXTENSIONS START
apply from : "cordova-plugin-fcm/upfront-FCMPlugin.gradle"
// PLUGIN GRADLE EXTENSIONS END

There are also these lines:

 dependencies {
compile fileTree(dir:'libs', include:'*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile project(path: "CordovaLib", configuration: "debug")
releaseCompile project(path: "CordovaLib", configuration: "release")
compile "com.facebook.android:facebook-android- sdk:4.14.+"
compile "com.google.android.gms:play-services-maps:+"
compile "com.google.android.gms:play-services-location:+"
// SUB-PROJECT DEPENDENCIES END
}

What am I missing and how can I solve this problem?

I solved it

plugings:

< p>https://github.com/mauron85/cordova-plugin-background-geolocation

https://github.com/fechanique/cordova-plugin-fcm

1) .Remove platform: cordova platform rm android.

2). Modify: plugins / cordova-plugin -fcm / src / android / FCMPlugin.gradle

Replace:

< p>

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

Yes:

ext.postBuildExtras = {< br /> apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

3) Add platform: cordova platform add android.

4) Modify: platforms / android / project.properties

Change the “” of “11.4.2”:

com.google.firebase:firebase-core:+
com.google.firebase:firebase-messaging:+
com.google.android.gms:play-services-location:+

It should look like this:

com.google.firebase:firebase-core:11.4.2
com.google.firebase:firebase-messaging:11.4.2
com.google.android.gms :play-services-location:11.4.2

That’s it:).

I am using ionic on Windows for Android 2. When I add Cordova-plugin-fcm plug-in, I can no longer build the project. This is the error I get:

BUILD FAILED 

Total time: 4.697 secs

Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (i
nformation about the latest version is available at https: //bintray.com/android/android-tools/com< br />.google.gms.google-services/) or updating the version of com.google.android.gms to 9.2.0.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get mor
e log output.

The following is a snippet of my config.xml:

< p>













< variable name="API_KEY_FOR_ANDROID" value="XXXX"/>




I have read this and this related posts, it is recommended to add this line to build.gradle (automatically created by ion):< /p>

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

I have Try to add it to build-extras.gradle without luck.

In my build.graddle, I see this line:

/ / PLUGIN GRADLE EXTENSIONS START
apply from: "cordova-plugin-fcm/upfront-FCMPlugin.gradle"
// PLUGIN GRADLE EXTENSIONS END

And these lines:

dependencies {
compile fileTree(dir:'libs', include:'*.jar')
// SUB-PROJECT DEPENDENC IES START
debugCompile project(path: "CordovaLib", configuration: "debug")
releaseCompile project(path: "CordovaLib", configuration: "release")
compile "com.facebook. android:facebook-android-sdk:4.14.+"
compile "com.google.android.gms:play-services-maps:+"
compile "com.google.android.gms:play- services-location:+"
// SUB-PROJECT DEPENDENCIES END
}

What am I missing and how can I solve this problem?

I solved it

plugings:

https://github.com/mauron85/ cordova-plugin-background-geolocation

https://github.com/fechanique/cordova-plugin-fcm

1). Delete platform: cordova platform rm android.

2). Modify: plugins / cordova-plugin -fcm / src / android / FCMPlugin.gradle

Replace:

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

Yes:

ext.postBuildExtras = {
apply plugin: com.google.gms. googleservices.GoogleServicesPlugin
}

3) Add platform: cordova platform to add android.

4) Modify: platforms / android / project.properties

Change the “” of “11.4.2”:

com.google.firebase:firebase-core:+
com.google.firebase:firebase-messaging:+
com.google.android.gms:play-services-location:+

It should look like this:

com.google.firebase :firebase-core:11.4.2
com.google.firebase:firebase-messaging:11.4.2
com.google.android.gms:play-services-location:11.4.2

That’s it:).

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3760 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.