cleverpush / cleverpush-flutter-sdk

Other
5 stars 2 forks source link

Dependency failing using cleverpush_flutter & firebase_analytics #61

Open markusrothenbacher opened 2 months ago

markusrothenbacher commented 2 months ago

In my Flutter project, I am using firebase_analytics: ^11.3.0 for tracking. Now I want to add push notification and added cleverpush_flutter: ^1.23.32 to my pubspec.yaml When I now try to build and run it on my Android Phone, I get the following compile error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processTwDevDebugResources'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2.
  1, 23.0.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.cleverpush:cleverpush:1.34.1 -> com.google.firebase:firebase-messaging@[10.2.1, 23.0.99], but fi
  rebase-messaging version was 24.0.0.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends on project 'cleverpush_flutter' which depends onto com.cleverpush:cleverpush@1.34.1
  -- Project 'app' depends onto com.cleverpush:cleverpush@[1.34.1]
  -- Project 'app' depends onto com.google.firebase:firebase-messaging@[24.0.0]

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = true }" to your bu
  ild.gradle file.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
Error: Gradle task assembleTwDevDebug failed with exit code 1

I tried downgrading firebase_analytics. The lowest which would compile was firebase_analytics: 10.0.1 which is 22 months old. But even then "firebase-messaging" was much newer compared to what "com.cleverpush:cleverpush:1.34.1" expected:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processTwDevDebugResources'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2.
  1, 23.0.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.cleverpush:cleverpush:1.34.1 -> com.google.firebase:firebase-messaging@[10.2.1, 23.0.99], but fi
  rebase-messaging version was 23.2.1.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends on project 'cleverpush_flutter' which depends onto com.cleverpush:cleverpush@1.34.1
  -- Project 'app' depends onto com.google.firebase:firebase-messaging@[23.2.1]
  -- Project 'app' depends onto com.cleverpush:cleverpush@[1.34.1]

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = true }" to your bu
  ild.gradle file.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
Error: Gradle task assembleTwDevDebug failed with exit code 1
gbhrdt commented 2 months ago

Hi @markusrothenbacher thanks for bringing this up. This is indeed

Did you try adding the following line at the bottom of app/build.gradle:

googleServices { disableVersionCheck = true }

(see https://developers.cleverpush.com/docs/sdks/flutter/troubleshooting)

markusrothenbacher commented 1 month ago

Hi @gbhrdt, yes it worked, but I have two comments about this:

  1. Why can you not keep your dependencies updated, so I don't have use a hacky workaround like this. This statement may or may not will break my dependencies with other google packages i use in the feature. So now I have to hope that it does not.
  2. If that is really your only solution, than I expect maximum comfort from a paid solution provider like you by adding this hack automatically to the build.gradle file on installing the flutter plugin, like for example this open source plugin is able to: flutter_flavorizr: android_build_gradle_processor.dart
gbhrdt commented 1 month ago

Hi @markusrothenbacher I am 100% on the same page here, we should handle the FCM dependency management in a more clean way. I raised an internal ticket for this.

In the future if you have any feature requests like this you can directly submit them to support@cleverpush.com referring to the client you work for :). This helps us a lot in terms of prioritization, since we do not have any information about the client here in GitHub.