multi-module:Project with path '' could not be found in project

i’m using gradle to build some projects.There are two top projects,one is “test1”,another is “test2”.“test1” has three modules:“module1”,“module2”,“module3”.Here is project layout for “test1” and “test2”:

Project test1
|——module1
    |——build.gradle
|——module2
    |——build.gradle
|——module3
    |——build.gradle
|——settings.gradle
|——build.gradle

Project test2
|——settings.gradle
|——build.gradle

The “settings.gradle” file in project “test1” is:

rootProject.name=‘test1’
include ‘module1’
include ‘module2’
include ‘module3’

In project ‘test1’,“module 2” depends on “module1”. The build.gradle file of “module2” is:

dependencies {
    compile project(‘:module1’)
}

Project “test2” depends on “module2” in project “test1”,so I edit the “settings.gradle” file in project “test2” like this:

rootProject.name=‘test2’
includeFlat ‘test1’
include ‘test1:module2’

when I excute the gradle build,i have the following error:

Project with path ‘:module1’ could not be found in project ‘:test1:module2’.

I don’t know what is wrong.As the error show,gradle seems to regard “module1” as the sub module of “module2”.Is there suggest how to solve this problem?

1 Like

Same issue, can anyone help? :cry:

OPs problem is, that he is using include in a very bad way. test2 includes a project of another multi-project build which is not a good idea. And of course as its dependency project is not also included (this is not the solution) it is missing. Instead the whole build test1 should have been included as composite build using includeBuild and the dependency declared with the coordinates.