Skip to content

Conversation

@tjzel
Copy link
Contributor

@tjzel tjzel commented Nov 24, 2025

Summary:

I noticed that in Reanimated monorepo executing a clean task in an example app results in an error due to RNGP trying to configure codegen-generated CMake targets after they have been removed.

Screenshot 2025-11-24 at 20 50 21

I think the error happens because configureReactNativeNdk is called on every task and it indiscriminately changes CMake configs in

if (ext.externalNativeBuild.cmake.path == null) {
ext.externalNativeBuild.cmake.path =
File(
extension.reactNativeDir.get().asFile,
"ReactAndroid/cmake-utils/default-app-setup/CMakeLists.txt",
)
}

You can reproduce it with a brand new community CLI app:

  1. npx @react-native-community/cli@latest init --skip-install --install-pods false --version 0.82 App82
  2. cd App82
  3. yarn
  4. yarn add @react-native-community/clipboard` (or any other library with codegen)
  5. Build the app in Android Studio
  6. Use Build -> Clean Project in Android Studio.

Alternatively, after building, you can add the following anywhere in android/app/build/generated/autolinking/src/main/jni/Android-autolinking.cmake

message(FATAL_ERROR "Reading codegen CMakeLists.txt during cleanup")

I think that since the cleanup process can be parallelized add_subdirectory for codegen-generated CMakeLists.txt shouldn't be picked up in the cleaning task.

Changelog:

[ANDROID] [FIXED] - RNGP trying to configure deleted generated CMake projects when executing cleaning task

Test Plan:

Applying the fix in a brand-new community CLI app fixes the issue.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 24, 2025
@facebook-github-bot facebook-github-bot added p: Software Mansion Partner: Software Mansion Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Nov 24, 2025
@cortinico
Copy link
Contributor

I don't think this is the right fix sadly. This will have a cascading effect resulting in invalidating the configuration cache if you call ./gradlew clean, because you're effectively changing the build configuration.

I think the underlying problem is a different one. There either a wrong task dependency, or we're cleaning too many things during ./gradlew clean.

I'll dm you to follow up the conversation as I think it's worth some investigation here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Software Mansion Partner: Software Mansion Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants