Gradle says the project path could not be found in the root project
Project with path ':mypath' could not be found in root project 'myproject'.Short answer
Gradle only knows modules that settings.gradle(.kts) declares with include. The path you reference in project(':name') must match an include entry, with colons for nesting, and the folder must exist. List the projects Gradle sees, then add or correct the include line.
Fix it fast
1Find out which cause you have
Ask Gradle which projects it knows. The path in your error must appear in this list.
./gradlew projects2Match what you see, then jump to its fix
What does the error look like?
Project with path ':mypath' could not be found in root project 'myproject'.
Cause 1 of 2
The module is not included in settings
1Check
Open the settings file and look for an include line for that module.
cat settings.gradle* | grep -n include2Fix
Declare the module with include. Gradle uses the settings file to decide which projects take part in the build.
// settings.gradle.kts
include(":app", ":mylib")3Verify
List the projects again.
./gradlew projectsConfirmed by docs.gradle.org
Cause 2 of 2
The path and the folder layout do not match
1Check
By default a project path maps to the same folder under the root: services:api is ./services/api. A mismatch in name, case or nesting makes the reference fail.
ls services/2Fix
Make the reference, the include entry and the folder agree, or point the project at its folder with projectDir.
include(":services:api")
// only when the folder has a different name:
project(":services:api").projectDir = file("backend/api")3Verify
Run the task that failed.
./gradlew projectsConfirmed by docs.gradle.org
How do I stop it coming back?
- Change include lines and folder names in the same commit.
- Run ./gradlew projects in CI to confirm the module list.
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:
Related fixes
Mobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile apps
adb tcpip 5555 fails because no device is found
adb: more than one device/emulator
adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.
4 causes, each with a fix