foojay-resolver-convention 0.5.0 in gradle-plugin is incompatible with Gradle 9.0.0
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 冷清
- 技術堆疊
- kotlin, react-native
研究方向
先檢查 @react-native/gradle-plugin 中的 settings.gradle.kts 和 gradle/wrapper/gradle-wrapper.properties,以確認 Gradle 和 foojay 的版本。清除 Gradle 快取後,使用 Expo Android 指令重現問題,然後驗證新專案是否能使用 Gradle 9.0.0 和更新後的 resolver 設定完成建置;同時檢查報告中提到的 --no-configure-on-demand 要求。
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- C++
- 星號
- 127k
- 分支
- 25.3k
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
react/react-native 的其他 Issue
-
Needs: Author Feedback Needs: Repro
難度 1/5 1 小時以內 新手友好度 92/100
react/react-native#58621 · 1 則留言 ·
-
Needs: Author Feedback Needs: Repro
難度 2/5 1-3 小時 新手友好度 85/100
react/react-native#58610 · 1 則留言 ·
-
Needs: Triage :mag:
難度 2/5 1-3 小時 新手友好度 82/100
react/react-native#58565 · 1 則留言 · 2 個 reaction ·
-
Needs: Author Feedback Needs: Repro
難度 2/5 1-3 小時 新手友好度 88/100
react/react-native#58555 · 4 則留言 · 1 個 reaction ·
-
Needs: Attention Needs: Repro
難度 2/5 1-3 小時 新手友好度 85/100
react/react-native#58526 · 2 則留言 ·
查看 react/react-native 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 90/100
AXERA-TECH/ax-llm#77 ·
-
難度 1/5 1 小時以內 新手友好度 90/100
games-on-whales/wolf#509 ·
-
難度 2/5 1-3 小時 新手友好度 74/100
-
bug-unconfirmed
難度 2/5 1-3 小時 新手友好度 76/100
-
難度 2/5 1-3 小時 新手友好度 74/100
NVIDIA/cuda-samples#453 ·