fechanique/cordova-plugin-fcm

Execution failed for task ':processDebugGoogleServices'

VinuOye opened this issue · 14 comments

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 (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 9.0.0.

please help me out from this issue........

THis is happening when both plugins google plus and fcm are using in an app. Both are very implement for every application.

thanks in andvance.

I am also getting the same error.

same here too.

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 9.0.0.

+1

I don't have much time left, and I was holding on to this lib because the other ones are too old and too hard to manage for both platforms at the same time.

I managed to make a workaround for this issue.

First of all, I changed all of my google libraries (on android project) to version 10.2.1. Maps and base libs are set to force their versions:

    compile("com.google.android.gms:play-services-location:10.2.1") { force = true; }
    compile("com.google.android.gms:play-services-base:10.2.1") {
        force = true;
    }
    compile 'com.android.support:support-v4:24.1.1'
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'

Still on app's gradle file, put apply plugin: 'com.google.gms.google-services' to the bottom of the file.

After syncing, I went to MainActivity.javaand changed the onCreate method to this:

    public void onCreate(Bundle savedInstanceState)
    {

        FirebaseApp.initializeApp(getApplicationContext());
        super.onCreate(savedInstanceState);
        ...
    }

This makes the 10.2.1 version of Firebase recognize your app's context, linking the API keys and initializing FCM securely.

Tested on my app and both plugins (push notifications and maps) are working great. Must work for another Google Services too.

I had forked this plugin to update FCM libs and it helps the first step above, so feel free to use it.

Step 1 (for FCM Plugin)

Comment out these lines in the FCMPlugin.gradle file.

classpath 'com.google.gms:google-services:3.0.0'
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

Step 2 (for FCM Plugin)

Change the plugin.xml of the FCM plugin.

framework src="com.google.firebase:firebase-core:9.8.0"
framework src="com.google.firebase:firebase-messaging:9.8.0"

Step 3 (for Cordova-googlemap)

framework src="com.google.android.gms:play-services-maps:9.0.0"
framework src="com.google.android.gms:play-services-location:9.0.0"

Step 4

Remove and re-add plattform.

Step 5 (build.gradle file of the android platform folder)

Add this line to the classpath section
classpath 'com.google.gms:google-services:3.1.0'

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.google.android.gms:play-services-maps:9.8.0"
compile "com.google.android.gms:play-services-location:9.8.0"
compile "com.google.firebase:firebase-core:9.8.0"
compile "com.google.firebase:firebase-messaging:9.8.0"
// SUB-PROJECT DEPENDENCIES END
}
And add this line below the dependencies, nearly at the bottom of the file
apply plugin: 'com.google.gms.google-services'

i found this solution and also thanks @troovers

Hi @usama-ayub, followed these steps and get stucked on same error:

  • What went wrong:
    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 9.8.0.

I noticed that my dependencies on the step 5 are diferent check it out, mainly both com.google.android.gms. How can I managed to get it equal to yours?

dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: "CordovaLib"))
compile "com.google.firebase:firebase-core:9.8.0"
compile "com.google.firebase:firebase-messaging:9.8.0"
compile "com.google.android.gms:play-services-maps:9.0.0"
compile "com.google.android.gms:play-services-location:9.0.0"
compile "com.onesignal:OneSignal:3.7.1"
// SUB-PROJECT DEPENDENCIES END
}
apply plugin: 'com.google.gms.google-services'

Did it really work for you? I mean, do you have both plugin buildable plugin installed (Maps & FCM)?

@LucasBSC can you send me build.gradle file

buildgradle.txt
@usama-ayub sure, follows the file attached.

I managed to get the versions equal to yours. But on the STEP 3 (Google Maps) I forced the version to 9.8.0 instead of 9.0.0 as you pointed. So the APK was built successfully but the notifications

I try to send does not come for all devices, it goes for only one specified Samsung S8 phone. Don't know whats happening at all.

There is a great solution for Firebase. One google-services.json file is needed declaring all your flavors as apps. https://medium.com/@Miqubel/multiple-build-types-in-firebase-on-android-6f6715f6dd83

I fixed the problem by changing classpath 'com.google.gms:google-services:3.2.0' to classpath 'com.google.gms:google-services:3.0.0'

I uncommented the gms ( exclude group: "com.google.android.gms") and it solved everything:

    compile (project(':react-native-camera')) {
            exclude group: "com.android.support"

            // uncomment this if also com.google.android.gms:play-services-vision versions are conflicting
            // this can happen if you use react-native-firebase
            exclude group: "com.google.android.gms"
        }

In platforms > android > cordova-plugin-fcm > app-FCMPlugin.gradle

  • remove line classpath 'com.google.gms:google-services:3.0.0'
  • remove line apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
  • remove and add platform again

In platforms > android > build.gradle

  • add classpath 'com.google.gms:google-services:3.0.0' in dependencies
  • add apply plugin: 'com.google.gms.google-services' at the end of dependencies
  • update dependencies as :
    compile "com.google.firebase:firebase-core:11.8.0"
    compile "com.google.firebase:firebase-messaging:11.8.0"
    compile "com.google.android.gms:play-services-auth:11.8.0"
    compile "com.google.android.gms:play-services-identity:11.8.0"

IF REQUIRED :

In plugins > cordova-plugin-fcm > plugin.xml to

  • remove and add the android platform again and redo the steps above.