eunoia
eunoia

Reputation: 3

How to add firebase ml kit in react native

Currently I am using firebase in react native project

"react-native-firebase": "5.6.0", in package.json file

I use firebase ml kit

yarn add @react-native-firebase/app
yarn add @react-native-firebase/ml-vision

I installed react-native-firebase/app as above.

"@react-native-firebase/app": "8.2.0",
"@react-native-firebase/ml-vision": "7.2.2",
"react-native-firebase": "5.6.0" in package.json file

When using like this, the following error occurs I think firebase is crashing Is there any way to solve this? Thanks for reading

* What went wrong:
Execution failed for task':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
  Program type already present: io.invertase.firebase.BuildConfig
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

Upvotes: 0

Views: 598

Answers (1)

Salakar
Salakar

Reputation: 6304

It looks like you're trying to mix together an old version of React Native Firebase ("react-native-firebase": "5.6.0") along with a new version of React Native Firebase ("@react-native-firebase/app": "8.2.0",)

These are both completely different implementations of React Native Firebase and shouldn't be mixed; the react-native-firebase one being an old implementation that hasn't been supported for almost 2 years. Is there a reason you're trying to mix them?

The packages that start with @react-native-firebase/* are the correct ones to be using.

I'd recommend following these docs;

If you have any further issues with React Native Firebase I'd recommend raising an issue on the project's GitHub repository here as this is the projects main support channel.

Upvotes: 1

Related Questions