Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ios GoogleDataTransport dependency error when using firebase_crashlytics #27

Closed
HakimKramdi opened this issue May 23, 2021 · 29 comments
Closed

Comments

@HakimKramdi
Copy link

Hello,

Im my project I have a these two dependencies:

google_ml_kit: 0.4.0
firebase_analytics: ^8.0.3
firebase_crashlytics: ^2.0.4

On android this works perfectly :)

But on on IOS when trying to use pod install I have this error:

[!] CocoaPods could not find compatible versions for pod "GoogleDataTransport":
In snapshot (Podfile.lock):
GoogleDataTransport (= 9.0.0, ~> 9.0)

In Podfile:
firebase_crashlytics (from .symlinks/plugins/firebase_crashlytics/ios) was resolved to 2.0.4, which depends on
Firebase/Crashlytics (= 8.0.0) was resolved to 8.0.0, which depends on
FirebaseCrashlytics (> 8.0.0) was resolved to 8.0.0, which depends on
GoogleDataTransport (
> 9.0)

google_ml_kit (from `.symlinks/plugins/google_ml_kit/ios`) was resolved to 0.0.1, which depends on
  GoogleMLKit/ImageLabeling was resolved to 0.60.0, which depends on
    GoogleMLKit/MLKitCore (= 0.60.0) was resolved to 0.60.0, which depends on
      MLKitCommon (~> 0.60.0) was resolved to 0.60.0, which depends on
        GoogleDataTransport (~> 3.2)

Is there a way to have google_ml_kit depending on a on higher version of GoogleDataTransport or any way to go around this issue ?

Thank you in advance

@bharat-biradar
Copy link
Collaborator

Hi @HakimKramdi thanks for opening the issue. I think according to this the GoogleDataTransport version should be 8.x. As the version here is 9 maybe it is causing this problem.

@HakimKramdi
Copy link
Author

HakimKramdi commented May 24, 2021

Hi @bharat-biradar thank you for your answer.
I tried a lot a ways to resolve this but did't find a way.

A simple way to reproduce this is to use your example project included in this repo.

I just added a dependency to firestore:
`dependencies:
flutter:
sdk: flutter

cloud_firestore: ^2.0.0 #added this only dependency

google_ml_kit:

`

in the IOS folder, with the command "pod install" I still have this error:

`[!] CocoaPods could not find compatible versions for pod "GoogleDataTransport":
In snapshot (Podfile.lock):
GoogleDataTransport (= 8.4.0, ~> 8.0)

In Podfile:
cloud_firestore (from .symlinks/plugins/cloud_firestore/ios) was resolved to 2.2.0, which depends on
Firebase/Firestore (= 8.0.0) was resolved to 8.0.0, which depends on
FirebaseFirestore (> 8.0.0) was resolved to 8.0.0, which depends on
FirebaseCore (
> 8.0) was resolved to 8.0.0, which depends on
FirebaseCoreDiagnostics (> 8.0) was resolved to 8.0.0, which depends on
GoogleDataTransport (
> 9.0)

google_ml_kit (from `.symlinks/plugins/google_ml_kit/ios`) was resolved to 0.0.1, which depends on
  GoogleMLKit/FaceDetection was resolved to 2.1.0, which depends on
    GoogleMLKit/MLKitCore (= 2.1.0) was resolved to 2.1.0, which depends on
      MLKitCommon (~> 2.1.0) was resolved to 2.1.0, which depends on
        GoogleDataTransport (~> 8.0)

You have either:

  • changed the constraints of dependency GoogleDataTransport inside your development pod cloud_firestore.
    You should run pod update GoogleDataTransport to apply changes you've made.`

This is the result fo flutter doctor:

`Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.0, on macOS 11.3 20E232 darwin-x64, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.56.2)
[✓] Connected device (2 available)

• No issues found!`

Does that mean it not possible to use any dependency to firebase with this plugin ?

Does anyone use this plugin with any firebase dependency like (cloud_firestore, firebase_crashlytics ... )

Regards,

@bharat-biradar
Copy link
Collaborator

@fbernaly Any suggestions on how to resolve this.

@fbernaly
Copy link
Collaborator

@HakimKramdi : the issue is the dependencies that each Flutter plugin has, when they are resolved by Flutter they depend on different versions.
As you can see our dependencies are not tight to any specific version:

https://github.com/bharat-biradar/Google-Ml-Kit-plugin/blob/master/ios/google_ml_kit.podspec#L19-L21

That means that our dependencies will adapt, you can change the pod version in your podfile.

But cloud_firestore does it, cloud_firestore has a dependency on a specific version, you can see here:

https://github.com/FirebaseExtended/flutterfire/blob/master/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore.podspec#L36

Luckily they provide a way to override firebase_sdk_version

You can find it here:

https://github.com/FirebaseExtended/flutterfire/blob/4b893b13664f39643fb8cd3d42c5e8d260e9fd82/docs/overview.mdx#iosmacos

I tried that in our example app, I added

  cloud_firestore: ^2.0.0

and then I added to the ios/Podfile at the top

# Override Firebase SDK Version
$FirebaseSDKVersion = '7.11.0'

and the dependencies are resolved.

Without that Firebase/Firestore is resolving to 8.0.0, but that is causing the issue, so I went back to '7.11.0' and that seems to work. You can tried a higher version but so far that is the one that has been working for me.

I hope that helps.

Confirm if this resolves your issue, so we can close it.

@Tom3652
Copy link

Tom3652 commented May 24, 2021

I am having the same issue :

[!] CocoaPods could not find compatible versions for pod "GoogleDataTransport":
  In Podfile:
    firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) was resolved to 2.0.4, which depends on
      Firebase/Crashlytics (= 8.0.0) was resolved to 8.0.0, which depends on
        FirebaseCrashlytics (~> 8.0.0) was resolved to 8.0.0, which depends on
          GoogleDataTransport (~> 9.0)

    google_ml_kit (from `.symlinks/plugins/google_ml_kit/ios`) was resolved to 0.0.1, which depends on
      GoogleMLKit/FaceDetection was resolved to 0.60.0, which depends on
        GoogleMLKit/MLKitCore (= 0.60.0) was resolved to 0.60.0, which depends on
          MLKitCommon (~> 0.60.0) was resolved to 0.60.0, which depends on
            GoogleDataTransport (~> 3.2)

But it's an issue for Google, not this plugin because it's Google's ML kit APIs that depends on an old version of GoogleDataTransport...
They should upgrade this themselves because they own both of these products

@fbernaly
Copy link
Collaborator

@Tom3652 : I agree with you, we are consuming their pods. In the meantime try the workaround I shared above.

@adriancsbna
Copy link

Hi @Tom3652.  

I have tried your solution but when I apply it, I get a conflict with google_mobile_ads in version 0.13.0

[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
  In Podfile:
    Firebase/MLVisionLabelModel was resolved to 5.0.0, which depends on
      Firebase/CoreOnly (= 5.0.0)

    firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 1.2.0, which depends on
      Firebase/CoreOnly (= 7.11.0)

CocoaPods could not find compatible versions for pod "GoogleAppMeasurement/AdIdSupport":
  In Podfile:
    firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) was resolved to 8.1.0, which depends on
      Firebase/Analytics (= 7.11.0) was resolved to 7.11.0, which depends on
        Firebase/Core (= 7.11.0) was resolved to 7.11.0, which depends on
          FirebaseAnalytics (~> 7.11.0) was resolved to 7.11.0, which depends on
            FirebaseAnalytics/AdIdSupport (= 7.11.0) was resolved to 7.11.0, which depends on
              GoogleAppMeasurement/AdIdSupport (= 7.11.0)

    google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`) was resolved to 0.0.1, which depends on
      Google-Mobile-Ads-SDK (= 8.5.0) was resolved to 8.5.0, which depends on
        GoogleAppMeasurement (< 9.0, >= 7.0) was resolved to 8.0.0, which depends on
          GoogleAppMeasurement/AdIdSupport (= 8.0.0)

@fbernaly
Copy link
Collaborator

@adriancsbna : we wont get a definitive solution until Google fixes their dependencies, my suggestion: try with a version that satisfies your project

# Override Firebase SDK Version
$FirebaseSDKVersion = '5.0.0'

@Tom3652
Copy link

Tom3652 commented May 25, 2021

@fbernaly you are right.

@adriancsbna the solution was provided by @fbernaly :
The only way so far is to downgrade the other SDK's versions.

That's why for now i am not using this plugin because i need more the latest SDKs for the other products than the ML unfortunately

I think i will make an issue on the flutter/flutter repo about it today directly for Google

@HakimKramdi
Copy link
Author

@fbernaly Thank you for the suggestion.

After downgrading my firebaseSdk version with
$FirebaseSDKVersion = '7.11.0'

I had another issue linked to the fact that I use
use_frameworks! in my Podfile

With this option, trying to use
pod install with the dependency google_ml_kit: 0.4.0 will produce this error:
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (GoogleUtilitiesComponents)

But after some research I used
use_frameworks! :linkage => :static in my Podfile to fix the issue.

I also had to downgrade some of my other dependencies to be compatible with the $FirebaseSDKVersion = '7.11.0'

But at the end everything is working.

For me it's ok for now, but I understand @Tom3652 , some projects may need the latest $FirebaseSDKVersion and this won't work for them.

I hope Google fixes their dependencies soon.

Thank again for the help

@fbernaly
Copy link
Collaborator

@Tom3652 and @HakimKramdi : Thanks for confirming that downgrading $FirebaseSDKVersion works. I know that it is not optimal, but since those pod dependencies are managed by Google, they need to update their pods.

Thanks for using this Flutter plugin. We are still working on Features and adding more every day.

@Tom3652
Copy link

Tom3652 commented May 26, 2021

Hello guys,

Just to tell you that the issue is now known by Google, there is a direct dependency conflict with the FirebaseCore pod in 8.0.0 because of GoogleDataTransport.
You may need to especially decrease this dependency version to firebase_core: 1.1.0 because the firebase_core: 1.2.0 is giving the error.

I will let you know once the issue is resolved by Google.

@Nickkorol
Copy link

Just faced the same problem, here are my steps to solve this problem:

  1. Downgraded firebase_core to version 1.1.0 and firebase_crashlytics to ^2.0.0
  2. Removed contents of Pods folder, Xcode's DerivedData and flutter cache using commands
    flutter clean
    rm -Rf ios/Pods
    rm -Rf ios/.symlinks
    rm -Rf ios/Flutter/Flutter.framework
    rm -Rf ios/Flutter/Flutter.podspec
    rm ios/Podfile
  3. Removed ${PODS_ROOT}/Fabric/run from Xcode Targets -> Build Phases (if you don't have one, skip this one)
  4. Run flutter run on iOS device.

Thank you guys for quick feedback! Please let me know when Google resolves this dependency conflict.

@edgarfroes
Copy link

@Nickkorol this didn't work for me, sadly.

@bhanuka96
Copy link

I downgrade my firebase plugins

firebase_messaging: 9.1.0
firebase_core: 1.1.0
firebase_crashlytics: 2.0.0
cloud_firestore: 2.0.0

google_ml_kit: ^0.5.1

Now, It's working to me

@lvlrSajjad
Copy link

@fbernaly I don't want to downgrade my plugins and I think it's not a solution.
I think we should keep this issue open until this problem gets solved.

@Tom3652
Copy link

Tom3652 commented Jun 6, 2021

The issue could stay opened but i have already created one in the FlutterFire repo as mentioned above.
Please write directly to this issue to improve "Google`s commitment" to fix this

@fbernaly
Copy link
Collaborator

fbernaly commented Jun 7, 2021

I understand that downgrading is not an optimal solution, but you need to understand as well that this plugin is a wrapper of the Google Decencies, all of the heavy lifting in done in the native frameworks provided by Google. The iOS dependencies are not open to us, and Google should fix the compatibility between their multiple pods.
So, we are going to keep this issue open just for the sake of visibility for everyone, but if you have more urgency: contribute to the issue that @Tom3652 created in the FlutterFire repo: issue #6240.
The fix should come from Google, not from our wrapper. The more people report the issue in their repo, the more noise they will get and maybe they will fix it.
Once you know that the issue is fixed by them, come back this issue and let us know to close this issue.

@fbernaly fbernaly reopened this Jun 7, 2021
@cngeru
Copy link

cngeru commented Jun 7, 2021

check out this google issue tracker

@slaniado
Copy link

Fix is planned to be released around the end of the month. link

@ericksprengel
Copy link

I downgraded manually my dependencies to:

  firebase_core: 1.1.1 # ^1.3.0
  cloud_firestore: 2.0.0 # ^2.2.2
  cloud_functions: 1.0.7 # ^1.1.2
  firebase_storage: 8.0.6 # ^8.1.3
  firebase_analytics: 8.0.4 # ^8.1.2
  firebase_auth: 1.1.4 #^1.4.1
  google_ml_kit: ^0.6.0

But I did it by trial and error.
Is there an easier way to do it? 😅

@fbernaly
Copy link
Collaborator

@ericksprengel: unfortunately no, there is no other way until Google fixes this: https://issuetracker.google.com/issues/188452839
Please go to that issue a leave a comment, so they could see that more people need the fix.

@LucioBevilacqua
Copy link

Seems like google fixed this yesterday: https://issuetracker.google.com/issues/188452839#comment13

@fbernaly
Copy link
Collaborator

fbernaly commented Jul 1, 2021

Fix is here

I was able to find a fix for this issue. Our current podspec does not specify the ML Kit versions: https://github.com/bharat-biradar/Google-Ml-Kit-plugin/blob/master/ios/google_ml_kit.podspec#L19-L26. And we want to keep it that way so it is open and you can set the version you need and be able to resolve dependencies that may conflict with other plugins. However you can specify the version in your pod file like this:

target 'Runner' do
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  # add these lines with the version you need
  pod 'GoogleMLKit/FaceDetection', '~> 2.2.0'
  pod 'GoogleMLKit/ImageLabeling', '~> 2.2.0'
  pod 'GoogleMLKit/ImageLabelingCustom', '~> 2.2.0'
  pod 'GoogleMLKit/BarcodeScanning', '~> 2.2.0'
  pod 'GoogleMLKit/TextRecognition', '~> 2.2.0'
  pod 'GoogleMLKit/PoseDetection', '~> 2.2.0'
  pod 'GoogleMLKit/PoseDetectionAccurate', '~> 2.2.0'
  pod 'GoogleMLKit/DigitalInkRecognition', '~> 2.2.0'
end

I tried this in our example app and it is working, I was able to run the app in iOS using these other plugins as well:

  firebase_analytics:
  firebase_crashlytics:
  cloud_firestore:

After running flutter pub get, the versions in pubspec.lock were resolved to firebase_analytics: 8.1.2, firebase_crashlytics: 2.0.7, and cloud_firestore 2.3.0.

After running pod install I got this in Podfile.lock: all GoogleMLKit pod were resolved to 2.2.0, Firebase to 8.0.0 and GoogleDataTransport to 9.0.1.

If you encounter issues with pod install, try deleting your Podfile.lock, and run pod update

Make sure that you are pulling the latest code from our master like this:

google_ml_kit:
    git:
      url: [email protected]:bharat-biradar/Google-Ml-Kit-plugin.git

Latest version in pub.dev is 0.6.0 however master have some recent changes that we will publish soon in 0.7.0.

I hope this helps. Thanks everyone for your patience.

@fbernaly fbernaly closed this as completed Jul 1, 2021
@utsavDave97
Copy link

@bharat-biradar

google_ml_kit:
    git:
      url: [email protected]:bharat-biradar/Google-Ml-Kit-plugin.git

When I tried this I got the following error:

Git error. Command: `git clone --mirror [email protected]:bharat-biradar/Google-Ml-Kit-plugin.git /Users/udave/.pub-cache/git/cache/Google-Ml-Kit-plugin-77ff36ec964122a474b4fd6b8c02c1a6fecd9393`
stdout: 
stderr: Cloning into bare repository '/Users/udave/.pub-cache/git/cache/Google-Ml-Kit-plugin-77ff36ec964122a474b4fd6b8c02c1a6fecd9393'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
exit code: 128

pub get failed (server unavailable) -- attempting retry 1 in 1 second...

Please advice

@om-ha
Copy link
Contributor

om-ha commented Sep 19, 2021

@utsavDave97

Use this in your pubspec.yaml instead:

  google_ml_kit:
      git:
        url: https://github.com/bharat-biradar/Google-Ml-Kit-plugin.git

Explanation:

  1. In my snippet above, you'd be cloning the repo using HTTPS not SSH.
  2. In your snippet however, you are basically cloning the repo using SSH but with no SSH key assigned to your GitHub account. Even if you create one, you should also make sure the SSH key is stored on the cloning machine (your machine). So GitHub can tell if you have access or not.

url: https://github.com/bharat-biradar/Google-Ml-Kit-plugin.git
url: [email protected]:bharat-biradar/Google-Ml-Kit-plugin.git

@om-ha
Copy link
Contributor

om-ha commented Sep 19, 2021

To re-iterate @fbernaly great answer, here are the exact steps to do here:

  1. Delete old iOS Podfile
rm -rf Podfile.lock
  1. Modify pubspec
dependencies:
  # ... some other dependencies go here
  google_ml_kit:
      git:
        url: https://github.com/bharat-biradar/Google-Ml-Kit-plugin.git
  1. Get flutter packages
flutter pub get
  1. Cocoapods update or install
    a. update pod update
    b. install pod install

NOTE:

As mentioned by the maintainers, this fix is temporary until the changes are updated on https://pub.dev/packages/google_ml_kit

@om-ha
Copy link
Contributor

om-ha commented Sep 19, 2021

I'm really unsure whether or not this was fixed in Version 0.7.1, changelog source.

If this was fixed, can we please update the README So that users like me are no longer directed to this issue?

@skanderhamdi
Copy link

skanderhamdi commented Oct 31, 2021

For anyone who faced the issue of FirebaseCoreOnly
Just add:
pod 'Firebase' in your podfile..
without any firebase_core in pubspec.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests