You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our project utilizes React Native Codegen for generating the necessary source code for our Native Modules, which is correctly placed in the host application's build path, typically under android/app/build/generated/source/codegen.
After adding @code-push-next/react-native-code-push, the Android build unexpectedly triggers Codegen a second time inside the library itself. This produces an extra copy of the same generated classes inside node_modules/@code-push-next/react-native-code-push/android/app/build/generated/source/codegen.
Because both the app and the library end up generating identical classes (for example, NativeCoreSpec under the same package namespace), the Dex merging step fails with duplicate-class errors.
We tried to disable codegen for @code-push-next/react-native-code-push with patch-package but it's not that easy.
After adding @code-push-next/react-native-code-push, the Android build unexpectedly triggers Codegen a second time inside the library itself. This produces an extra copy of the same generated classes inside node_modules/@code-push-next/react-native-code-push/android/app/build/generated/source/codegen.
That's really interesting. So, you mean, the generated files are misplaced inside of @code-push-next/react-native-code-push package redundantly?
Created a React Native application in version 0.80 using @react-native-community/cli.
I've added a turbo module based on official docs and integrated with @code-push-next/react-native-code-push for Android and iOS.
The outcome is that the Android build fails when you attempt to create a Release build.
To replicate it:
Open project in Android Studio, switch Build Variant to Release.
Next run Build -> Clean project and after that Build -> Assemble project
After that, you should get dex merge error about duplicated Spec classes.
One under: android/app/build/generated/source/codegen/jni/NativeLocalStorageSpec.h
and duplicated under: node_modules/@code-push-next/react-native-code-push/android/app/build/generated/source/codegen/jni/NativeLocalStorageSpec.h
The one under node_modules/@code-push-next/react-native-code-push/android/app/build/generated/source/codegen shouldn't exist, but for some reason it's generated.
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.turbomoduleexample.NativeLocalStorageSpec is defined multiple times: /Users/sabastiancyrych/dev/react-native-code-push-integration/android/app/build/intermediates/project_dex_archive/release/dexBuilderRelease/out/com/turbomoduleexample/NativeLocalStorageSpec.dex, /Users/sabastiancyrych/dev/react-native-code-push-integration/node_modules/@code-push-next/react-native-code-push/android/app/build/.transforms/9698f260acd07e3e7275272cb4aa42b2/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/turbomoduleexample/NativeLocalStorageSpec.dex
I am running into the same issue if I add a brand new turbo module to the application. Works just fine if there is no native module added. Seems like the library delegates its codegen tasks to the main application which generates the code for both main application modules and once again for Codepush. The library doesn’t fully support new architecture seems like it still relies on the interoperability layer.
I fixed this on my end by writing a gradle script to remove the duplicates that were generated under node_modules/@code-push-next. But I think long term the library needs to update its handling of new architecture overall
Activity
CHOIMINSEOK commentedon Dec 7, 2025
Hey @scyrych Thanks for reaching us.
That's really interesting. So, you mean, the generated files are misplaced inside of
@code-push-next/react-native-code-pushpackage redundantly?scyrych commentedon Dec 9, 2025
Hey @CHOIMINSEOK. I've created a repository when you can easily replicate my issue.
https://github.com/scyrych/react-native-code-push-integration
Created a React Native application in version 0.80 using @react-native-community/cli.
I've added a turbo module based on official docs and integrated with @code-push-next/react-native-code-push for Android and iOS.
The outcome is that the Android build fails when you attempt to create a
Releasebuild.To replicate it:
Open project in Android Studio, switch Build Variant to
Release.Next run
Build -> Clean projectand after thatBuild -> Assemble projectAfter that, you should get dex merge error about duplicated Spec classes.
One under:
android/app/build/generated/source/codegen/jni/NativeLocalStorageSpec.hand duplicated under:
node_modules/@code-push-next/react-native-code-push/android/app/build/generated/source/codegen/jni/NativeLocalStorageSpec.hThe one under
node_modules/@code-push-next/react-native-code-push/android/app/build/generated/source/codegenshouldn't exist, but for some reason it's generated.decebalus1 commentedon Dec 16, 2025
I am running into the same issue if I add a brand new turbo module to the application. Works just fine if there is no native module added. Seems like the library delegates its codegen tasks to the main application which generates the code for both main application modules and once again for Codepush. The library doesn’t fully support new architecture seems like it still relies on the interoperability layer.
I fixed this on my end by writing a gradle script to remove the duplicates that were generated under node_modules/@code-push-next. But I think long term the library needs to update its handling of new architecture overall
julhenry commentedon Dec 18, 2025
@decebalus1 we’re facing the same issue. I managed to fix it with a patch, but it was quite tricky. Could you share your script, please?
CHOIMINSEOK commentedon Jan 6, 2026
Hi guys @julhenry @decebalus1 @scyrych
I'm really sorry for late response. I've been swamped with bunch of things so far.
I checked the issue and make a PR for addressing this. After regression test, I will release patch version.
Special thanks for repro repo ❤️ @scyrych
#37