React Native Android build cannot find the foojay-resolver-convention plugin
Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '0.5.0'] was not found in any of the following sources:Short answer
The foojay plugin is a settings plugin that Gradle downloads from the Plugin Portal. It is not found when pluginManagement leaves the portal out of its repositories, when the plugins block is not first in settings.gradle, or when the old 0.x version meets Gradle 9, which it does not support. Fix the one the output shows.
Fix it fast
1Find out which cause you have
Open android/settings.gradle and read it from the top, then ask the wrapper which Gradle version runs the build. The error lines also name the sources Gradle searched.
cd android sed -n 1,20p settings.gradle ./gradlew --version2Match what you see, then jump to its fix
- 1
The pluginManagement block has a repositories list that does not contain gradlePluginPortal().pluginManagement does not list the Gradle Plugin PortalFix - 2
The error comes from settings.gradle and the plugins block sits below other code.The plugins block is not the first block in settings.gradleFix - 3
./gradlew --version prints Gradle 9, or the plugin version in settings.gradle is below 1.0.0.An old 0.x plugin version on a Gradle version it does not supportFix
- 1
What does the error look like?
Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '0.5.0'] was not found in any of the following sources:Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention'] was not found in any of the following sources:
Cause 1 of 3
pluginManagement does not list the Gradle Plugin Portal
1Check
The Gradle docs say plugins resolve from the Plugin Portal by default, and that a pluginManagement repositories list without gradlePluginPortal() removes the portal from the search. Look for a repositories block in the pluginManagement section of settings.gradle.
grep -n -A8 "pluginManagement" android/settings.gradle2Fix
Add gradlePluginPortal() to the list. Keep the pluginManagement block as the first block in the file.
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
includeBuild("../node_modules/@react-native/gradle-plugin")
}3Verify
Run any Gradle task from the android folder and confirm settings are evaluated.
cd android && ./gradlew helpConfirmed by docs.gradle.org
Cause 2 of 3
The plugins block is not the first block in settings.gradle
1Check
The Gradle docs say the plugins block in a settings file must appear before any other block there, except pluginManagement which has to be first of all.
grep -n "pluginManagement\|^plugins\|include" android/settings.gradle2Fix
Order the file as pluginManagement, then plugins, then the rest.
pluginManagement { /* ... */ }
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
rootProject.name = 'MyApp'3Verify
Run the help task again.
cd android && ./gradlew helpConfirmed by docs.gradle.org
Cause 3 of 3
An old 0.x plugin version on a Gradle version it does not support
1Check
The foojay README says versions before 1.0.0 work with Gradle 7.6 through 8.14.x, and versions from 1.0.0 need Gradle 7.6 or later and Java 17 or later.
./gradlew --version
grep -n "foojay" android/settings.gradle2Fix
Raise the plugin to 1.0.0 or later and run Gradle on JDK 17 or newer. If your Gradle itself is below 7.6, update the wrapper; the Gradle docs say to run the wrapper task, twice to refresh all wrapper files.
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
# only if Gradle is below 7.6:
./gradlew :wrapper --gradle-version <version>3Verify
Run the version check, then a task.
./gradlew --version && ./gradlew helpConfirmed by github.com
How do I stop it coming back?
- Take the settings.gradle from the template of the React Native version you upgrade to, and merge changes by hand.
- Upgrade the Gradle wrapper and the foojay plugin together.
- Pin the plugin to an exact version, not a range.
- Use the same JDK in Android Studio, the terminal and CI.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
Gradle says the plugin id you asked for does not exist in any repository it searched
Gradle Central Plugin Repository (no 'google()' listed)
Gradle searched every repository listed for plugins and none had that id at that version.
3 causes, each with a fixBack end
Gradle cannot calculate the javaCompiler for compileJava
Failed to calculate the value of task ':compileJava' property 'javaCompiler'
The build asks for a Java toolchain version that Gradle cannot find on the machine.
2 causes, each with a fixMobile apps
Android build stops at processDebugManifest in a React Native app
Manifest merger failed
processDebugManifest is the step that merges your AndroidManifest.xml with the manifests of every library.
2 causes, each with a fixMobile apps
Kotlin and Java compile to different JVM targets in a React Native Android build
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11)
Gradle refuses to build when the Java task and the Kotlin task target different JVM versions.
3 causes, each with a fixMobile apps
Gradle cannot run node in a React Native Android build
Process 'command 'node'' finished with non-zero exit value 1
The React Native Gradle plugin starts node for bundling.
3 causes, each with a fixMobile apps
The Android emulator opens the app but never connects to Metro or Expo
Metro bundler ECONNREFUSED 127.0.0.1:19001
When the emulator cannot reach Metro, first prove each side on its own: adb sees the emulator, and Metro listens on its port.
4 causes, each with a fix