foojay-resolver-convention 0.5.0 in gradle-plugin is incompatible with Gradle 9.0.0

Open Beginner friendly
#56,287 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
kotlin, react-native

Research direction

Start with settings.gradle.kts in @react-native/gradle-plugin and gradle/wrapper/gradle-wrapper.properties to confirm the Gradle and foojay versions. Reproduce with the Expo Android commands after clearing Gradle caches, then verify a fresh project builds with Gradle 9.0.0 and the updated resolver configuration; also check the reported --no-configure-on-demand requirement.

Written by the indexing model from the issue text.

Description

Needs: Attention Needs: Repro

Description

The @react-native/gradle-plugin bundles settings.gradle.kts with:

plugins { id("org.gradle.toolchains.foojay-resolver-convention").version("0.5.0") }

React Native 0.83.x uses Gradle 9.0.0 (set in gradle/wrapper/gradle-wrapper.properties), but foojay-resolver-convention 0.5.0 depends on FoojayToolchainsPlugin, a class that was removed in Gradle 9.0.0.

This causes a build failure on any fresh project or after clearing Gradle caches.

Steps to reproduce

npx create-expo-app@latest --template default@sdk-55
cd <project>
rm -rf ~/.gradle/caches
npx expo run:android

Error

FAILURE: Build failed with an exception.

* Where:
Settings file 'android/settings.gradle' line: 21

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> org/gradle/toolchains/foojay/FoojayToolchainsPlugin

Full stacktrace:

Caused by: java.lang.NoClassDefFoundError: org/gradle/toolchains/foojay/FoojayToolchainsPlugin
    at org.gradle.toolchains.foojay.FoojayToolchainsConventionPlugin.apply(FoojayToolchainsConventionPlugin.kt:11)

Root cause

Component Version
react-native 0.83.4
@react-native/gradle-plugin 0.83.4
Gradle 9.0.0
foojay-resolver-convention 0.5.0

Gradle 9.0.0 removed the FoojayToolchainsPlugin class that foojay 0.5.0 depends on. Versions 0.8.0+ of foojay-resolver-convention are compatible with Gradle 9.0.0.

Verified fix

Updating settings.gradle.kts in @react-native/gradle-plugin from:

plugins { id("org.gradle.toolchains.foojay-resolver-convention").version("0.5.0") }

to:

plugins { id("org.gradle.toolchains.foojay-resolver-convention").version("0.9.0") }

resolves the issue. The build also requires --no-configure-on-demand to avoid a related metadata.bin generation failure.

Affected versions

  • react-native 0.83.0 through 0.84.1 (all ship foojay 0.5.0 with Gradle 9.0.0)
  • Expo SDK 55 (uses react-native 0.83.x)
  • Reproducible on macOS (ARM64) with Java 17 and Node 24

Environment

System: macOS 26.3.1 (arm64)
Node: v24.14.0
Java: OpenJDK 17.0.18 (Zulu)
Gradle: 9.0.0
react-native: 0.83.4
Expo SDK: 55.0.9
Dominant language
C++
Stars
127k
Forks
25.3k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react/react-native

All issues in react/react-native

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.