android: inject ExecOperations for Gradle 9 compatibility#386
Merged
kraenhansen merged 1 commit intoJul 24, 2026
Merged
Conversation
React Native 0.87 bumps the Gradle wrapper to 9.x, which removed
Project.exec(). The linkNodeApiModules task used the bare `exec {}` closure
in its doLast action, so every Android build (and the gradle.test.ts unit
test on all platforms) failed with:
Could not find method exec() ... on task ':react-native-node-api:linkNodeApiModules'
Inject the ExecOperations service via an @Inject-annotated interface and call
injectedExecOps.execOps.exec {} instead, the supported Gradle 9 replacement.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TVfanKvtyfSsoMgZv3DJtY
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Targets the
kh/adopt-static-h-node-apibranch (PR #372).Problem
RN 0.87 (adopted in #372) bumps the Gradle wrapper to 9.x, which removed
Project.exec(). ThelinkNodeApiModulestask inpackages/host/android/build.gradlecalls the bareexec {}closure inside itsdoLastaction, so on Gradle 9 every Android build fails at configuration/execution with:On the #372 branch this reddened every unit-test lane (
gradle.test.tsbuilds this module on ubuntu/macOS/windows) as well as the Test app (Android) job.Fix
Use the Gradle 9 supported replacement: inject the
ExecOperationsservice via an@Inject-annotated interface and callinjectedExecOps.execOps.exec {}instead of the removedProject.exec().The command line, streams and environment passed to
execare unchanged.Test plan
gradle.test.tsbuilds the Android module successfully).linkNodeApiModulesfailure (remaining Android e2e work is still tracked on Adopt Hermes' first-party Node-API (static_h) #372).Generated by Claude Code