LinusU / LinusU/react-native-get-random-values

android builds fails due to duplicate class with react-native-random-uuid

Offen
#44 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
415
Forks
63
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

ive been looking into generating random values in react-native. i found this library at first and used it together with the `uuid` library. i then saw this issue: https://github.com/LinusU/react-native-get-random-values/issues/32

where someone suggested to add `crypto.randomUUID()` too. to keep the library clean, you made a new library: https://github.com/LinusU/react-native-random-uuid

i then installed that library to try it as well. then when i build the android app the build fails and i get an error like this:

```
* What went wrong:
Execution failed for task ':app:mergeLibDexDevelopmentDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Type org.linusu.BuildConfig is defined multiple times: /Users/adb/dev/APP_NAME/node_modules/react-native-get-random-values/android/build/.transforms/aa2fd757f1fb328047e3f797775fb731/transformed/classes/classes.dex, /Users/adb/dev/APP_NAME/node_modules/react-native-random-uuid/android/build/.transforms/ce3394d28852a5322f9e5e76c2b08d87/transformed/classes/classes.dex
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
```

with a link to: https://developer.android.com/build/dependencies?buildsystem=ndk-build#duplicate_classes

i think the problem lies here:

> Type org.linusu.BuildConfig is defined multiple times

i dont know if this value can even be changed. i know some package names cannot be changed after they have been released.

this may not be a problem realistically, as there may not be a reason to have both libraries installed at the same time. i was just experimenting to see how they worked.

the build was also successful as soon as a deleted `react-native-get-random-values`.

also as a sidenote, im not sure if this is also the case for ios. i currently have some unrelated problems with some ios pods which means i cant even install pods successfully. maybe someone else can test it out to see if it also happens on ios.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduce the Android build with both react-native-get-random-values and react-native-random-uuid installed, starting with the mergeLibDexDevelopmentDebug failure. Inspect the two Android build outputs for the duplicate org.linusu.BuildConfig definition; done means the cause and a compatible outcome for both libraries are established, with iOS checked separately if relevant.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, javascript, react-native
Bereich
build-system, mobile
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.