Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version conflict between gms:play-services-vision and firebase

I've installed both react-native-firebase and react-native-camera. The camera was fine when play-services -vision was stuck at 12.0.1, but I just ran into this error (Error updating property googleVisionBarcodeDetectorEnable) https://github.com/react-native-community/react-native-camera/issues/1844 that requires an upgrade to 15.0.2.

It looks like there are Google Play Services and Firebase conflicts when play-services-vision is bumped up to 15.0.2 from 12.0.1:

Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[
  15.0.1], but play-services-basement version was 16.0.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 onto com.google.firebase:[email protected]
  -- Project 'app' depends onto com.google.android.gms:[email protected]
  -- Project 'app' depends onto com.google.firebase:[email protected]
  -- Project 'app' depends onto com.google.android.gms:[email protected]

I've tried com.google.android.gms:[email protected] but it gave me exceed 64k methods error. Bumping up to 17.0.2 would cause a version conflict from com.google.android.gms:play-services-basement.

Anyone using both react-native-firebase and react-native camera? Can you tell me how to solve this version conflict problem?

Here is the dependencies in android/app/build.gradle

dependencies {

    implementation (project(':react-native-camera')) {
      exclude group: "com.google.android.gms"
      implementation "com.android.support:exifinterface:${rootProject.ext.supportLibVersion}"
      implementation ('com.google.android.gms:play-services-vision:12.0.1') {
        force = true
      }
    }
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-webview')
    implementation project(':react-native-fast-image')
    implementation project(':react-native-google-signin')
    implementation project(':react-native-firebase')
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation ('com.google.android.gms:play-services-base:16.0.1')
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true
    }
    implementation(project(':react-native-google-signin')) {
        exclude group: "com.google.android.gms" // very important
    }
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation 'com.facebook.react:react-native:+'
    implementation project(':react-native-sqlite-storage')
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'com.facebook.fresco:animated-gif:1.10.0'
}

Ext in android/build.gradle

ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 19
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "27.1.1"
}

Package:

"react-native-camera": "^1.6.4",
"react-native-firebase": "^5.1.1",
like image 650
RedGiant Avatar asked Dec 28 '18 08:12

RedGiant


People also ask

Does Firebase-ml-Vision support Google services?

Firebase support channel. When I use the latest version of firebase-ml-vision which is 24.1.0, the google service plugin (com.google.gms:google-services:4.3.3) isn't compatible with it. It display some error in gradle console such as

Which Firebase SDKs require Google Play Services?

Which Firebase SDKs require Google Play services? Which Firebase SDKs require Google Play services? Some Firebase Android SDKs depend on Google Play services , which means they will only run on devices and emulators with Google Play services installed.

Which Firebase SDKs use the'Google-services'plugin?

Note: The 'google-services' gradle plugin is used by all Firebase SDKs, but this plugin is not related to Google Play services. Which Firebase SDKs require Google Play services?

What are the different types of Firebase SDK?

Firebase SDKs can be divided into three categories: Play services required — These SDKs require Google Play services, otherwise they have no functionality. Play services recommended — These SDKs require Google Play services to have full functionality, but they still offer most functionality even without Google Play services.


2 Answers

You need to update the version of gms:play-services-vision. implementation 'com.google.android.gms:play-services-vision:17.0.2'

like image 108
Varun Avatar answered Oct 30 '22 23:10

Varun


For anyone here after ejecting from Expo (v34) into a react-native project wanting to use firebase, and if you kept using expo-barcode-scanner, the problem lies in it because it's using an older version of play-services-vision.

You have multiple options:

  • If a new Expo SDK is released, use it. I'm sure the vision library will be upgraded.
  • Remove expo-barcode-scanner as a dependency and use another one.
  • Pump the version of the vision library in expo-barcode-scanner lib in node_modules\expo-barcode-scanner\android\build.gradle (discouraged)
like image 27
Bassel Shmali Avatar answered Oct 30 '22 21:10

Bassel Shmali