Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle says the project path could not be found in the root project

ErrorProject 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.

  • Applies to Gradle 8 and 9, Android Gradle Plugin 8.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask Gradle which projects it knows. The path in your error must appear in this list.

    ./gradlew projects
  2. 2Match what you see, then jump to its fix

    1. 1The module folder exists but is missing from the gradlew projects listThe module is not included in settingsFix
    2. 2A nested module such as services:api is referenced with the wrong colons or the wrong folder nameThe path and the folder layout do not matchFix

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 include

2Fix

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 projects

Confirmed by docs.gradle.org

Did this fix it?

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 projects

Confirmed by docs.gradle.org

Did this fix it?

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

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 fix

Mobile 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

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.