callstack / callstack/react-native-builder-bob

Nitro module library crash on android example build

Abierto
#896 2 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
JavaScript
Estrellas
3.2k
Forks
228
Merge medio
7 d 12 h
PR fusionados (30 d)
3

Descripción

### Description

After generating new library using `npx create-react-native-library@latest awesome-librar` and selecting "Nitro module" option, installing packages with `yarn`, and running `yarn example android`, I encountered an error.
It looks like unused `react-native-safe-area-context` dependency from example app is getting registered multiple times.
```
Execution failed for task ':app:mergeLibDexDebug'.
> 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:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Type com.facebook.react.viewmanagers.RNCSafeAreaProviderManagerDelegate is defined multiple times: /Users/john/Desktop/awesome-library/android/build/.transforms/9286b72b4f9552335ae00fc4394f0219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/RNCSafeAreaProviderManagerDelegate.dex, /Users/john/Desktop/awesome-library/example/node_modules/react-native-safe-area-context/android/build/.transforms/def7637fb683de95fb0b5f690e7a6ad7/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/RNCSafeAreaProviderManagerDelegate.dex
```

I tried to find the duplicate, but the only place where it's declared is in `example/package.json`:
```
yarn why react-native-safe-area-context
└─ awesome-library-example@workspace:
└─ react-native-safe-area-context@npm:5.6.1 [fb98e] (via npm:^5.5.2 [fb98e])
```

Creating library with Turbo module does not result in the same error, even though `react-native-safe-area-context` is also present there.

### Packages

- [ ] create-react-native-library
- [x] react-native-builder-bob

### Selected options

Image

### Link to repro

https://github.com/jaworek/awesome-library

### Environment

System:
OS: macOS 26.0
CPU: (11) arm64 Apple M3 Pro
Memory: 393.58 MB / 36.00 GB
Shell:
version: 5.3.3
path: /nix/store/j26b6rcrvvpvqqcq5gmzxxipjb8ycy09-bash-interactive-5.3p3/bin/bash
Binaries:
Node:
version: 20.19.4
path: /opt/homebrew/bin/node
Yarn:
version: 3.6.1
path: /nix/store/38vyy0sbiqaq3r5liws3yfhxlhgcwsyz-yarn-berry-3.8.7/bin/yarn
npm:
version: 10.8.2
path: /opt/homebrew/bin/npm
Watchman:
version: 2025.09.15.00
path: /etc/profiles/per-user/john/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /etc/profiles/per-user/john/bin/pod
SDKs:
iOS SDK: Not Found
Android SDK:
API Levels:
- "33"
- "35"
- "36"
Build Tools:
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
System Images:
- android-33 | Android TV ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
- android-36 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2025.1 AI-251.26094.121.2513.14007798
Xcode:
version: /undefined
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /etc/profiles/per-user/john/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.1
wanted: 0.81.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.