flutter-ml / google_ml_kit_flutter

A flutter plugin that implements Google's standalone ML Kit
MIT License
907 stars 709 forks source link

update BarcodeScanning dependency #619

Closed ivofernandes closed 2 months ago

ivofernandes commented 2 months ago

Needed to update the dependency because I work on a project that uses google_mlkit_barcode_scanning and also mobile_scanner,

the problem was caused because they were using different versions of BarcodeScanning

https://github.com/flutter-ml/google_ml_kit_flutter/blob/develop/packages/google_mlkit_barcode_scanning/ios/google_mlkit_barcode_scanning.podspec#L18 https://github.com/juliansteenbakker/mobile_scanner/blob/master/ios/mobile_scanner.podspec#L18

And would return this error [!] CocoaPods could not find compatible versions for pod "GoogleMLKit/BarcodeScanning": In Podfile: google_mlkit_barcode_scanning (from .symlinks/plugins/google_mlkit_barcode_scanning/ios) was resolved to 0.11.1, which depends on GoogleMLKit/BarcodeScanning (~> 5.0.0)

mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) was resolved to 5.0.0, which depends on
  GoogleMLKit/BarcodeScanning (~> 6.0.0)

As this was the project that was lagging behind I decided to update and for me it worked

fbernaly commented 2 months ago

We already tried 6.0.0, look at this PR: https://github.com/flutter-ml/google_ml_kit_flutter/pull/613#issuecomment-2067814926 and we had to revert it (https://github.com/flutter-ml/google_ml_kit_flutter/pull/617) because 6.0.0 is still not available to the public. They have it in their sample app but when you run pod install or pod update this is what you get:

[!] CocoaPods could not find compatible versions for pod "GoogleMLKit/BarcodeScanning":
  In Podfile:
    google_mlkit_barcode_scanning (from `.symlinks/plugins/google_mlkit_barcode_scanning/ios`) was resolved to 0.11.1, which depends on
      GoogleMLKit/BarcodeScanning (~> 6.0.0)

None of your spec sources contain a spec satisfying the dependency: `GoogleMLKit/BarcodeScanning (~> 6.0.0)`.

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Please verify that 6.0.0 is available by compiling our example app and also update all other iOS plugin dependencies accordingly.

ivofernandes commented 2 months ago

Okay I'm not sure what do you mean about "not available to the public"

My problem was that my project also uses mobile_scanner, and it uses the version 6, and looks like flutter can't support the 2 different versions, but anyway, I'm not fully aware of all the use cases this project support and is just used to extract a qr_code from an image in my use case, and in this branch it worked, so I can just leave the import that I'm using now

google_mlkit_barcode_scanning:
    git:
      url: https://github.com/ivofernandes/google_ml_kit_flutter.git
      path: packages/google_mlkit_barcode_scanning
      ref: afa3615ff6df768495cf73f37c6a4aa7c6dec49a

And about the mobile scanner, you can check here that they are using the same

s.dependency 'GoogleMLKit/BarcodeScanning', '~> 6.0.0'

https://github.com/juliansteenbakker/mobile_scanner/blob/master/ios/mobile_scanner.podspec#L18

So I don't get what is not available to the public

fbernaly commented 2 months ago

Ok, I found the issue in our example app and I was able to update all the dependencies. This PR https://github.com/flutter-ml/google_ml_kit_flutter/pull/621 includes all the changes. It will be merged and release tomorrow.

ivofernandes commented 2 months ago

Amazing :) Thanks!

fbernaly commented 2 months ago

New version with 6.0.0

https://pub.dev/packages/google_mlkit_barcode_scanning

ivofernandes commented 2 months ago

Thanks :)