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
{{ message }}
This repository was archived by the owner on Aug 4, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 4, 2026. It is now read-only.
[Android] buildCMakeDebug race condition: libNitroModules.so not found #3163
When building for Android, the build intermittently fails with a linker error because IAP's buildCMakeDebug[arm64-v8a] task runs before react-native-nitro-modules has finished producing libNitroModules.so.
This fixed it for me. Add to android/build.gradle in react-native-iap:
afterEvaluate {
tasks.configureEach { task ->
if (task.name.startsWith('buildCMake')) {
def nitroProject = rootProject.findProject(':react-native-nitro-modules')
if (nitroProject) {
def nitroTask = nitroProject.tasks.findByName(task.name)
if (nitroTask) {
task.dependsOn(nitroTask)
}
}
}
}
}
I have several nitro modules in my project. I am not sure why IAP is the only one with this issue.
@jslok Thanks for the detailed report and the proposed fix! 👍
What I found: I searched the repository for android/build.gradle, buildCMake, afterEvaluate, libNitroModules, and externalNativeBuild. The android/build.gradle file is referenced in CONTRIBUTING.md (line 158) as the file that "triggers the native C++ build (via CMake/externalNativeBuild)", but the file itself is not accessible in the current codebase snapshot — so I cannot confirm or deny whether the afterEvaluate block is already present.
The proposed fix looks reasonable for a Nitro Modules-based library:
This should be added to android/build.gradle in the library root.
A few questions for the maintainers:
Is android/build.gradle intentionally excluded from the repo (generated by Nitrogen)? If so, this fix may need to go into the Nitrogen template or a custom gradle script.
Is this reproducible only with parallel Gradle builds (--parallel)? That would help confirm the ordering issue.
Other Nitro modules in the user's project don't hit this — could there be something specific about how IAP's CMake target links against libNitroModules.so compared to other Nitro modules?
Maintainers: please check android/build.gradle and confirm whether the afterEvaluate task dependency block is missing.
🤖 Generated by gitdog.dev · Have more questions? Tag @gitdog and let me know!
Thanks for the report and the fix suggestion @jslok!
This has been merged in #3165. The afterEvaluate block now ensures buildCMake* tasks depend on the corresponding react-native-nitro-modules tasks.
We investigated the nitro-modules 0.35.0 upgrade — no CMake/Gradle build order changes were made upstream, so this was a pre-existing race condition that likely became more visible with the recent upgrade.
Activity
gitdogbot commentedon Mar 9, 2026
@jslok Thanks for the detailed report and the proposed fix! 👍
What I found: I searched the repository for
android/build.gradle,buildCMake,afterEvaluate,libNitroModules, andexternalNativeBuild. Theandroid/build.gradlefile is referenced inCONTRIBUTING.md(line 158) as the file that "triggers the native C++ build (via CMake/externalNativeBuild)", but the file itself is not accessible in the current codebase snapshot — so I cannot confirm or deny whether theafterEvaluateblock is already present.The proposed fix looks reasonable for a Nitro Modules-based library:
afterEvaluate { tasks.configureEach { task -> if (task.name.startsWith('buildCMake')) { def nitroProject = rootProject.findProject(':react-native-nitro-modules') if (nitroProject) { def nitroTask = nitroProject.tasks.findByName(task.name) if (nitroTask) { task.dependsOn(nitroTask) } } } } }This should be added to
android/build.gradlein the library root.A few questions for the maintainers:
android/build.gradleintentionally excluded from the repo (generated by Nitrogen)? If so, this fix may need to go into the Nitrogen template or a custom gradle script.--parallel)? That would help confirm the ordering issue.libNitroModules.socompared to other Nitro modules?Maintainers: please check
android/build.gradleand confirm whether theafterEvaluatetask dependency block is missing.🤖 Generated by gitdog.dev · Have more questions? Tag
@gitdogand let me know!fix(android): add CMake task dependency on nitro-modules to prevent r…
hyochan commentedon Mar 10, 2026
Thanks for the report and the fix suggestion @jslok!
This has been merged in #3165. The
afterEvaluateblock now ensuresbuildCMake*tasks depend on the correspondingreact-native-nitro-modulestasks.We investigated the nitro-modules 0.35.0 upgrade — no CMake/Gradle build order changes were made upstream, so this was a pre-existing race condition that likely became more visible with the recent upgrade.
Will be included in the next release.