React-native-firebase: 馃敟 [馃悰] Pod version for ML Vision Label is wrong

Created on 10 Nov 2020  路  12Comments  路  Source: invertase/react-native-firebase

Issue

I've just upgraded to the latest version (9), and when running pod install I'm getting the following error:

[!] CocoaPods could not find compatible versions for pod "Firebase/MLVisionLabelModel":
  In Podfile:
    RNFBMLVision (from `../node_modules/@react-native-firebase/ml-vision`) was resolved to 7.4.13, which depends on
      Firebase/MLVisionLabelModel (~> 7.0.0)

None of your spec sources contain a spec satisfying the dependency: `Firebase/MLVisionLabelModel (~> 7.0.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

[!] NPM package '@react-native-firebase/analytics' depends on '@react-native-firebase/app' v8.4.7 but found v9.0.0, this might cause build issues or runtime crashes.

[!] NPM package '@react-native-firebase/ml-vision' depends on '@react-native-firebase/app' v8.4.7 but found v9.0.0, this might cause build issues or runtime crashes.

[!] NPM package '@react-native-firebase/analytics' depends on '@react-native-firebase/app' v8.4.7 but found v9.0.0, this might cause build issues or runtime crashes.

[!] NPM package '@react-native-firebase/ml-vision' depends on '@react-native-firebase/app' v8.4.7 but found v9.0.0, this might cause build issues or runtime crashes.

[!] NPM package '@react-native-firebase/analytics' depends on '@react-native-firebase/app' v8.4.7 but found v9.0.0, this might cause build issues or runtime crashes.

[!] NPM package '@react-native-firebase/ml-vision' depends on '@react-native-firebase/app' v8.4.7 but found v9.0.0, this might cause build issues or runtime crashes.

(The bottom lines are only warning, but first [!] is an error)

Project Files






Javascript

Click To Expand

#### `package.json`:

        "@react-native-firebase/analytics": "^7.6.10",
        "@react-native-firebase/app": "^9.0.0",
        "@react-native-firebase/auth": "^9.3.5",
        "@react-native-firebase/crashlytics": "^8.5.2",
        "@react-native-firebase/dynamic-links": "^7.5.13",
        "@react-native-firebase/firestore": "^7.10.2",
        "@react-native-firebase/functions": "^7.4.12",
        "@react-native-firebase/messaging": "^8.0.1",
        "@react-native-firebase/ml-vision": "^7.4.13",
        "@react-native-firebase/perf": "^7.4.12",
        "@react-native-firebase/storage": "^7.4.14",
#### `firebase.json` for react-native-firebase v6:
{
  "react-native": {
    "ml_vision_image_label_model": true,
    "ml_vision_label_model": true,
    "messaging_android_notification_color": "@color/mediumslateblue",
    "crashlytics_ndk_enabled": true
  }
}
### iOS
Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'Springsale' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # React Native Admob Native Ads
  pod 'Google-Mobile-Ads-SDK'

  # Barcode detection for RNCamera
  pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
    'BarcodeDetectorMLKit'
  ]
  target 'SpringsaleTests' do
    inherit! :complete
    # Pods for testing
  end

  use_native_modules!

  # Enables Flipper.
  # Note that if you have use_frameworks! enabled, Flipper will not work and you should disable these next few lines.
  pod 'flipper-plugin-react-native-performance', :path => "../node_modules/flipper-plugin-react-native-performance/ios", :configuration => 'Debug'
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
    # Copy CocoaPods Licenses
    require 'fileutils'
    FileUtils.cp_r('Pods/Target Support Files/Pods-Springsale/Pods-Springsale-Acknowledgements.plist', 'Settings.bundle/Acknowledgements.plist', :remove_destination => true)
  end
end
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:

// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->


Environment

Click To Expand

**`react-native info` output:**

info Fetching system and libraries information...
(node:22409) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 5.74 GB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 15.0.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.1, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK:
      API Levels: 25, 26, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.0, 30.0.0, 30.0.1
      System Images: android-28 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: 21.3.6528147
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6626763
    Xcode: 12.1/12A7403 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_272 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^16.14.0 => 16.14.0 
    react-native: ^0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

- **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `9` - **`Firebase` module(s) you're using that has the issue:** - `MLVision` - **Are you using `TypeScript`?** - irrelevant




Needs Triage Bug

All 12 comments

Versions are independent, so version '9' is not really descriptive, version 9 of which?

You'll want to update all of the packages and make sure you've got the underlying SDKs updated as well (firebase-ios-sdk 7.0.0 and firebase-android-sdk 26.0.0) if you have them overridden

This was published literally just minutes ago so I'm still test integrating it myself and haven't updated the test harness https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh yet - just about to then I should have this nailed

Also, you will want to look at the breaking changes in the releases document - the problem is I think noted there. The ml-vision package is dead. Long live ml - all details in related docs - never go up a major version without checking those

I can't reproduce this with my (now up to date) test harness after migrating it according to the breaking change documentation: https://github.com/mikehardy/rnfbdemo/commit/2bab72b2a99d2e16e6f3d24a6147c71be6bbd07a

Note that you may not be able to adopt these package versions until the work on react-native-mlkit is done. While we have about 132,000 weekly downloads of @react-native-firebase/app we have only 1,093 weekly downloads of @react-native-firebase/ml-vision (and even fewer of ml-natural-language!) so we chose not to hold up the forward port of the main react-native-firebase packages while we did the infrastructure work to pull on-device / 'Google ML Kit' inference over to the new react-native-mlkit package.

I do not believe there is an action here then as the current packages do work together and are working, though your issue may not be thoroughly solved until on-device inference code is re-homed and launched under react-native-mlkit

@mikehardy sorry for writing such a messy issue, I was in a real hurry yesterday.

  1. I read the release notes and couldn't figure out exactly what I'm supposed to do to fix this, that's why I wanted to report the bug early (was confused because I couldn't find a react-native-mlkit package, I didn't know it was still WIP. If you need help with that, I'd gladly lend a hand!)
  2. I had all kinds of weird errors with FirebaseCore not being resolved to the correct version until I figured it out: react-native-camera required the MLVision models. So if anyone else is experiencing this, remove react-native-camera. It's deprecated anyways.

Sorry again and thanks @mikehardy for your awesome work in this community.

Oh no, I need react-native-camera and use it to do barcodes still 馃槄 - I didn't realize it was deprecated

Yes the ML breaking changes could use some better documentation, I made the breaking changes note a bit more descriptive in response to your (understandable) confusion: https://github.com/invertase/react-native-firebase/blob/master/packages/ml/CHANGELOG.md#breaking-changes

I will need help with react-native-mlkit, when I've got something up there to test I could tag you in for an early look. Is there some use case you use specifically? By usage the vision barcode should be first, then vision text, then I'm not sure, probably the rest all at once

Yeah, I've just decided to create my own camera natively since all-rounder packages aren't really the best choice anyways. If you're interested, react-native-camera-kit recently moved from wix to tesla, they haven't started devlopment yet and it doesn't have type declarations, but I've tried it and it works fine. Not sure what they use for barcode recognition tho, looks like it's done natively..

I'm using ML Vision for Image labelling of local photos. Are you writing the library yourself? I could do the iOS part if you want :)

react-native-mlkit will be under Invertase organization, I will be starting it with the code from here (previous ml-vision / ml-natural-language packages' code) and my intention is to have it be similar to react-native-firebase - as close to a zero-conf / easy-to-integrate set of isolated packages as possible, each wrapping exactly one model from Google ML Kit with 1-to-1 API coverage of the underlying SDKs. Really boring in other words ;-), except for the majesty of things working haha

I have been in contact with @davidgovea who did an initial PR to port react-native-camera to Google ML Kit from Firebase Vision and our collective thinking is that react-native-camera could purge the ML code and wrap the react-native-mlkit offering, with some native interfaces for speed/latency reasons.

react-native-camera has 40x the community of react-native-camera-kit, and a similar dominance over expo-camera, I'm loath to see it die - I'd prefer for it to be possible for the react-native-mlkit barcode scanning to be easily pluggable underneath any of these libraries and centralize it

Oh, and the offer for the iOS is - separately - really really valuable to me. iOS is my weak side so I will need the help!

  1. The ml-vision / ml-natural-language packages don't have a lot of code, so I'd prefer to rewrite the iOS parts in Swift, since I'm not that good at Objective-C.
  2. Sorry I didn't quite understand what you meant with that comment, are you planning on updating react-native-camera to use react-native-mlkit under the hood? That would be a good idea, but I'm not sure how that would work out if I write the iOS part in Swift... 馃

1- not a lot of code, but always take a big pause before throwing away battle-tested code :)
2- that is the idea yes, there is no reason react-native-camera should have this sizable machine language inference engine in it, is there? especially not if inference will have a well-supported semi-official implementation in react-native-mlkit... if that constrains to Obj-C, I'd stick with Obj-C

My implementation plan, regardless, is a straight port of ml-vision and ml-natural existing code just to a new namespace and packaging infrastructure so that react-native-firebase existing userbase has a straight migration path after the breaking change PR I just merged. That's job #1. That implies Obj-C as it is just re-homing

Everything after that is gravy - i.e., adding native interface for react-native-camera to bolt on, switching to typescript and perhaps Cavy.app from Detox, any possible port from Java to Kotlin and/or Obj-C to Swift, perhaps separation of underlying native to a bundled ios framework / android aar so Flutter could re-use, etc

  1. It doesn't _have_ to be, you can call Swift functions from Objective-C - but it's easier if it's both Objective-C.

Sounds like that's more of a "renaming and migrating" task, not so much "implementing stuff".

Hit me up once you need some iOS help. 馃憤

Was this page helpful?
0 / 5 - 0 ratings