transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

gradle conflicts with another plugin's gradle (cordova-plugin-fcm) #427

Closed Scombr0 closed 5 years ago

Scombr0 commented 6 years ago

Your Environment

Expected Behavior

It should build the application.

Actual Behavior

It throws an error wether I use ionic cordova build androidor ionic cordova run android --target=<id>

Steps to Reproduce

  1. Install cordova-plugin-fcm (https://github.com/fechanique/cordova-plugin-fcm): ionic cordova plugin add cordova-plugin-fcm
  2. Install this plugin: ionic cordova plugin add https://github.com/transistorsoft/cordova-background-geolocation-lt.git
  3. Build: ionic cordova build android

Context

I'm trying to build the application. Nothing else.

Debug logs

This are the logs from console when trying to build android platform:

Found com.google.android.gms:play-services-location:+, but version 9.0.0 is needed for the google-services
    plugin.
    Found com.google.firebase:firebase-core:+, 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

    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.

    * 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: 1.56 secs
    Error: /Users/id/Documents/a/b/c/project/platforms/android/gradlew: 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.

We are really interested in this plugin, but we need to make this 2 plugins to work. How can I solve this gradle conflicts?

PS: Everything works as expected when I remove cordova-plugin-fcm. Same if I remove this plugin and leave cordova-plugin-fcm installed.

Thanks for your time, I hope you can help me here, we are really interested in this plugin.

christocracy commented 6 years ago

I have a solution which involves a pull request I submitted to Cordova-plugin-fcm, which I'll document here Friday when I return from vacation;

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

christocracy commented 6 years ago

Actually, the steps are documented in my pull request there at Cordova-plugin-fcm

Scombr0 commented 6 years ago

So, following those steps i'll be able fix it and to use them both? At least until that fix merges with master?

christocracy commented 6 years ago

It is required that they merge my PR or you fork their plugin and apply my PR yourself.

you must follow the exact steps in that PR

Scombr0 commented 6 years ago

What about those hooks in config.xml and scripts in platforms/android? All I see is 1 modified file.. not much.

I'm sorry, i'm kinda new and really need this to work :)

christocracy commented 6 years ago

There are 3 steps documented there. Simply Follow each step exactly.

Scombr0 commented 6 years ago

So, I did all the steps in that PR, and also included your fix into my fork :)

But now i'm getting this error in app-FCMPlugin.gradle.

* What went wrong:
        A problem occurred evaluating script.
        > Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
        > For input string: "+"
Scombr0 commented 6 years ago

Couldn't make it work, and timing isn't good for a wait in merging that pull request. Ended up changing to plugin https://github.com/arnesson/cordova-plugin-firebase. Both plugins work together with no conflicts.

Btw, great job on this plugin @christocracy.

christocracy commented 6 years ago

I suggest everyone avoid using cordova-plugin-fcm and find an alternative.

Clearly this plugin has little support.

elmbrent commented 5 years ago

I have this problem with intercom & your plugin

christocracy commented 5 years ago

@elmbrent Start here

elmbrent commented 5 years ago

Chris is there any chance I can contact you for freelance job to fix the intercom plugin with yours?

elmbrent commented 5 years ago

This would include us buying a license to :)

christocracy commented 5 years ago

Paste your platforms/android/project.properties

elmbrent commented 5 years ago

target=android-27 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.system.library.1=com.android.support:support-v4:24.1.1+ cordova.gradle.include.1=cordova-plugin-intercom/online-intercom.gradle cordova.gradle.include.2=cordova-plugin-intercom/online-build-extras-intercom.gradle cordova.system.library.2=com.onesignal:OneSignal:3.10.8 cordova.gradle.include.3=onesignal-cordova-plugin/online-build-extras-onesignal.gradle

This is without cordova-background-geolocation-lt

christocracy commented 5 years ago

Android support libraries' major version is supposed to correspond to your target=android-27.

Your problem is one of your plugin importing a very old version of:

com.android.support:support-v4:24.1.1+
target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
-cordova.system.library.1=com.android.support:support-v4:24.1.1+
+cordova.system.library.1=com.android.support:support-v4:27.+
cordova.gradle.include.1=cordova-plugin-intercom/online-intercom.gradle
cordova.gradle.include.2=cordova-plugin-intercom/online-build-extras-intercom.gradle
cordova.system.library.2=com.onesignal:OneSignal:3.10.8
cordova.gradle.include.3=onesignal-cordova-plugin/online-build-extras-onesignal.gradle
elmbrent commented 5 years ago

This is from the cordova-plugin-camera, we need this functionality in are app, we are using the latest.

elmbrent commented 5 years ago

When I remove the camera I still get the same issue `* What went wrong: Execution failed for task ':app: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 11.+.`

target=android-27 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.gradle.include.1=cordova-plugin-background-fetch/online-build.gradle cordova.system.library.1=com.google.android.gms:play-services-location:16.+ cordova.system.library.2=com.android.support:appcompat-v7:27.+ cordova.system.library.3=com.squareup.okhttp3:okhttp:3.12.+ cordova.system.library.4=org.greenrobot:eventbus:3.0.0 cordova.system.library.5=com.intentfilter:android-permissions:1.0.43 cordova.system.library.6=org.slf4j:slf4j-api:1.7.25 cordova.system.library.7=com.github.tony19:logback-android:1.3.0-2 cordova.gradle.include.2=cordova-background-geolocation-lt/online-build.gradle cordova.gradle.include.3=cordova-plugin-intercom/online-intercom.gradle cordova.gradle.include.4=cordova-plugin-intercom/online-build-extras-intercom.gradle cordova.system.library.8=com.onesignal:OneSignal:3.10.8 cordova.gradle.include.5=onesignal-cordova-plugin/online-build-extras-onesignal.gradle

christocracy commented 5 years ago

intercom is screwed, hard-coding firebase-messaging:11.+.

Google did a big split of Play Services & Firebase a few months back. It used to be the case that one would provide a common version between the two.

Now Firebase and Play-services dependencies are independent of each other. firebase-messaging did the split at v15.0.0 (notice the jump from 12.0.1 -> 15.0.0). Intercom needs to get with the program and provide a config variable to allow you to provide your own version (and they should be defaulting to latest available version, which is 18.0.0.

elmbrent commented 5 years ago

Any chance you can create a fork and fix this or can I do this and change to 18 or is it not that simple? Is this something I can hire you for?

christocracy commented 5 years ago

My rate is $300/hour. It will take at least 2 hours.

elmbrent commented 5 years ago

Let me talk to my boss and get back to you, whats the best email to get you on?

elmbrent commented 5 years ago

I've added you onto skype @ christocracy@gmail.com I've got confirmation to get you to build

christocracy commented 4 years ago

@elmbrent I need you to create a Hello World project that produces the error. I've added the following plugins into my own Hello World and it builds:

$ cordova plugins
cordova-background-geolocation-lt 3.0.5 "BackgroundGeolocation"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-cocoalumberjack 0.0.4 "CocoaLumberjack"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-intercom 6.2.0 "Intercom"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
onesignal-cordova-plugin 2.4.7 "OneSignal Push Notifications"