Type com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil is defined multiple times
Asked Answered
R

1

5

Hello guys I want to use react-native-jitsi-meet in my mobile project and I use react-native-jitsi-meet "^2.2.0" version, "react-native": "0.66.2" version and "@react-native-async-storage/async-storage": "github:react-native-async-storage/async-storage" package, In my android/app/build.gradle I exclude async-storage but I still get this error, Is there anyone can understand what is the problem.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Type com.reactnativecommunity.asyncstorage.AsyncLocalStorageUtil is defined multiple times

> implementation(project(':react-native-jitsi-meet')) {
>             exclude group: 'com.facebook',module:'hermes'
>             exclude group: 'com.facebook.react',module:'@react-native-async-storage/async-storage'
>             exclude group: 'com.facebook.react',module:'react-native-svg'
>             exclude group: 'com.facebook.react',module:'react-native-linear-gradient'
>             exclude group: 'com.facebook.react',module:'react-native-vector-icons'
>             transitive = true
>         }
Ruralize answered 15/1, 2022 at 10:21 Comment(3)
that's tell you define async-storage multiple time , check your code and see where you define againCoup
I checked but when I erase that exclude line for async-storage it gave me same errorRuralize
after that . delete android/app/build folder and clean project and build againCoup
S
11

The issue with my project was that the dependency "@react-native-community" already has a sub directory of async-storage. If you are using both @react-native-async-storage, and @react-native-community, it wont be able to build.

Remove either @react-native-community or @react-native-async-storage. Preferably remove @react-native-community/async-storage because the docs state that "Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage"

Then run npm install.

Smolder answered 8/9, 2022 at 20:46 Comment(1)
To be clear, @react-native-async-storage/async-storage is the package to keep.Catamite

© 2022 - 2024 — McMap. All rights reserved.