Code Monkey home page Code Monkey logo

Comments (25)

 avatar commented on July 25, 2024 2

I am also experiencing the same, and also posted this under Issue #51.

When I run:
cordova build android
I get the following:
What went wrong: A problem occurred configuring root project android. Cannot add task :processDebugGoogleServices' as a task with that name already exists.

I am attempting to use Firebase Analytics (cordova-plugin-firebase-analytics) which requires the plugin, Google Services (cordova-support-google-services). I am also using Firebase Cloud Messaging (cordova-plugin-fcm). The cordova-plugin-fcm includes Google Services 3.0.0 and the cordova-support-google-services has Google Services at 3.1.0 creating the conflict.

I am new to using Ionic 3/Angular 4. A fix I had found on a different forum, and implemented, was changing the version in platforms/android/cordova-support-google-services to 3.0.0 from 3.1.0. This was only a temporary fix, and a Sr. Dev on my team said this was terrible and should never be done. Of course, I do not want to do something that is a bad practice, however, what this error informed me of is that if I can get the dependencies at the same version, then the conflict resolves and the project builds.

Any guidance you can offer would be extremely helpful.

Thank you!

from cordova-plugin-firebase-analytics.

CookieCookson avatar CookieCookson commented on July 25, 2024 2

I had a chance to sit down and give this a go myself today. Managed to get the build to compile with minimal changes to the originals!

My steps were:

ionic start blank
cordova platform add android
cordova plugin add cordova-plugin-fcm # stock plugin from npm
# add valid google-services.json
cordova plugin add cordova-plugin-firebase-analytics # stock plugin from npm
cordova build android --device
# compiler shows error as above

I modified dev-build.gradle on cordova-support-google-services so it using google-services:3.0.0 instead of 3.1.0 as suggested above, and then after doing cordova build android --device then it compiles successfully! So you only need to modify cordova-support-google-services and none of the library versions for firebase.

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024 1

Thanks @CookieCookson

That solution gives the following error:

Could not get unknown property 'FIREBASE_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Of course, still, removing the analytics plugin manages to build

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024 1

6.2.3 same error

from cordova-plugin-firebase-analytics.

gecko-8 avatar gecko-8 commented on July 25, 2024 1

In case it helps anyone, I currently have everything working with following versions:
Cordova - 7.1.0 (backed off from 8 due to compatibility issues with some plugins (sorry, can't remember which ones)
phonegap-plugin-push - 2.1.3
cordova-plugin-firebase-analytics - 0.12.1

Also important was to install the plugins with the following commands (note the variables):
cordova plugins add cordova-plugin-firebase-analytics --variable FIREBASE_VERSION="11.6.2"
cordova plugins add phonegap-plugin-push --variable FCM_VERSION="11.6.2"

from cordova-plugin-firebase-analytics.

mailtoamirjohn avatar mailtoamirjohn commented on July 25, 2024

Me too facing the same problem with the cordova-plugin-fcm and cordova-plugin-firebase-analytics
plugins so I switched to another plugin.

For Android use this pluing: (Working well only with andriod not showing notification in ios)
https://www.npmjs.com/package/cordova-plugin-firebase
cordova plugin add [email protected] --save

For IOS:

Searching for solution...

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024

@mailtoamirjohn Thanks, I can't have a partial solution so I'll wait for a response

from cordova-plugin-firebase-analytics.

CookieCookson avatar CookieCookson commented on July 25, 2024

@AmitMY I've had conflicts with this plugin too, you will have to fork one (or more) of the plugins that have conflicting libraries and make the library versions match rather than conflict. See here for how I got it to play along with phonegap-plugin-push and cordova-plugin-admob-pro.

I locked all of the plugins to 11.0.1 and it didn't seem to have any adverse side effects as they were all around that version anyway.

from cordova-plugin-firebase-analytics.

mailtoamirjohn avatar mailtoamirjohn commented on July 25, 2024

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024

Thanks @CookieCookson

I created a 11.0.1 version of fcm, but still same error.
Full log:

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
        JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
        Reading build config file: D:\dev\apps\humhum\build.json
        Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
        :wrapper
        
        BUILD SUCCESSFUL
        
        Total time: 11.374 secs
        Subproject Path: CordovaLib
        google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default 
        version: 9.0.0 will be used.
        please apply google-services plugin at the bottom of the build file.
        The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use 
        Task.doLast(Action) instead.
                at build_hmeztw3cfkd79acx8eubooco.run(D:\dev\apps\humhum\platforms\android\build.gradle:143)
        The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
        Incremental java compilation is an incubating feature.
        The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please 
        use TaskInputs.file(Object).skipWhenEmpty() instead.
        Download https://maven.google.com/com/google/firebase/firebase-analytics/11.0.1/firebase-analytics-11.0.1.pom
        Download 
        https://maven.google.com/com/google/firebase/firebase-analytics-impl/11.0.1/firebase-analytics-impl-11.0.1.pom
        Download 
        https://maven.google.com/com/google/android/gms/play-services-basement/11.0.1/play-services-basement-11.0.1.pom
        Download https://maven.google.com/com/google/firebase/firebase-common/11.0.1/firebase-common-11.0.1.pom
        Download https://maven.google.com/com/google/firebase/firebase-iid/11.0.1/firebase-iid-11.0.1.pom
        Download 
        https://maven.google.com/com/google/android/gms/play-services-tasks/11.0.1/play-services-tasks-11.0.1.pom
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        A problem occurred configuring root project 'android'.
        > Cannot add task ':processDebugGoogleServices' as a task with that name already exists.
        
        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
        
        BUILD FAILED
        
        Total time: 8.456 secs
        Error: cmd: Command failed with exit code 1 Error output:
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        A problem occurred configuring root project 'android'.
        > Cannot add task ':processDebugGoogleServices' as a task with that name already exists.
        
        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

from cordova-plugin-firebase-analytics.

CookieCookson avatar CookieCookson commented on July 25, 2024

@HeatherWolford - this sounds like a suitable temporary workaround for now, as the libs are similar versions we can hope it doesn't cause any version mismatch errors. To implement a fix for this, it is probably recommended that the 3.0.0 dependency is removed from cordova-plugin-fcm and the plugin uses the cordova-support-google-services dependency. You can do this following my advice from above and creating a clone/fork of the initial repo and making the necessary changes for this.

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024

Does anyone have working forks to use that are using the correct versions for no mismatch?

from cordova-plugin-firebase-analytics.

OneToMany avatar OneToMany commented on July 25, 2024

Also have a same problem... If you use fcm plugin alone with google service 9.0 that will cause problem with crash apps on some Samsung device.
Didi you try CookieCookson solution?

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024

I tried the 3.1.0, using these forks:

<plugin name="cordova-plugin-fcm" spec="https://github.com/AmitMY/cordova-plugin-fcm-11.0.1.git" />
<plugin name="cordova-plugin-firebase-analytics" spec="https://github.com/Elixel/cordova-plugin-firebase-analytics-firebase-core-11.0.1.git" />

It now errors, with:

BUILD FAILED in 3m 7s

Found com.google.firebase:firebase-core:11.0.1, but version 9.0.0 is needed for the google-services plugin.
Found com.google.firebase:firebase-messaging:+, but version 9.0.0 is needed for the google-services plugin.
:processDebugGoogleServices FAILED
11 actionable tasks: 11 executed
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 (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.

from cordova-plugin-firebase-analytics.

CookieCookson avatar CookieCookson commented on July 25, 2024

Strange, not got that happening here. What version of cordova-android are you running?

from cordova-plugin-firebase-analytics.

AmitMY avatar AmitMY commented on July 25, 2024

6.4.0

from cordova-plugin-firebase-analytics.

CookieCookson avatar CookieCookson commented on July 25, 2024

I've not made the plunge yet to 6.4.0, I know it has some major changes - can you try with cordova-android 6.2.3 or 6.3.0?

from cordova-plugin-firebase-analytics.

michaeljcoyne avatar michaeljcoyne commented on July 25, 2024

I get this error also on 6.2.3

from cordova-plugin-firebase-analytics.

CookieCookson avatar CookieCookson commented on July 25, 2024

@AmitMY @michaeljcoyne this seems to be an issue with the latest version of the plugin and not related to this issue as such (it was added in a commit for version 0.12.1) and is also reported here: #55

Try installing the previous version of the plugin using cordova plugin add [email protected] and see if you still get the problem.

from cordova-plugin-firebase-analytics.

gecko-8 avatar gecko-8 commented on July 25, 2024

@CookieCookson I'm getting the same issue but I'm using phonegap-plugin-push (probably works the same). I tried switching to 0.12.0 and that solved the issue. So you're likely correct that it was introduced in 0.12.1.

from cordova-plugin-firebase-analytics.

alexandre-pereira avatar alexandre-pereira commented on July 25, 2024

@AmitMY I got the same error.

from cordova-plugin-firebase-analytics.

mailtoamirjohn avatar mailtoamirjohn commented on July 25, 2024

I am using this plugin , It works fine in both android and ios.

from cordova-plugin-firebase-analytics.

gecko-8 avatar gecko-8 commented on July 25, 2024

@mailtoamirjohn Is there any way you can let us know which versions of each plugin and Cordova you're using?

from cordova-plugin-firebase-analytics.

pauliusjacionis avatar pauliusjacionis commented on July 25, 2024

I'm also having the same problem.

$ cordova --version
8.0.0
$ cordova plugins ls | grep phonegap-plugin-push
phonegap-plugin-push 2.0.0-rc1 "PushPlugin"

I'll look into upgrading phonegap-plugin-push to see if that solves anything. @mailtoamirjohn what phonegap-plugin-push version are you using?

from cordova-plugin-firebase-analytics.

chemerisuk avatar chemerisuk commented on July 25, 2024

The conflict will be fixed after merging of fechanique/cordova-plugin-fcm#495

from cordova-plugin-firebase-analytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.