title: How i can use one project with sub projects in another project as sub project (sub module) with gradle?
body: <p>There is some gradle - android project A. It's Depends on a few gradle sub-projects, that situated each on its own git repository, and connected, to our project by git sub module(I can look it in my owr repository as it sub directory of my project.)</p>
  
  <p>project hierarhy is:</p>
  
  <pre><code>└─ ProjectRootDir                                  --- projectA
               ├─ gradle
               ├─ mainProject
               │   └─ subprojectA                    --- submoduleA
               │        ├─ libs
               │        ├─ src
               │        ├─ settings.gradle
               │        └─ build.gradle
               ├─ relatedProjects                   --- folder for submodules
               │  ├─ subprojectA                    --- submoduleA
               │  │  ├─ library
               │  │  ├─ gradle
               │  │  ├─ libs
               │  │  └─ relatedProjects             --- related projects for submoduleA
               │  │     ├─ subprojectAA             --- first submodule of submoduleA
               │  │     │  ├─ Test
               │  │     │  ├─ libs
               │  │     │  ├─ src
               │  │     │  ├─ settings.gradle
               │  │     │  └─ build.gradle
               │  │     └─ subprojectAB             --- first submodule of submoduleA
               │  │        ├─ libs
               │  │        ├─ src
               │  │        ├─ tests
               │  │        ├─ settings.gradle
               │  │        └─ build.gradle
               │  └─ subprojectB                    --- submodule of submoduleB
               │     ├─ demo
               │     ├─ gradle
               │     ├─ library
               │     ├─ settings.gradle
               │     └─ build.gradle
               ├─ settings.gradle
               └─ build.gradle
  </code></pre>
  
  <p>mainProject build.gradle</p>
  
  <pre><code>apply plugin: 'android'
  
  repositories {
      mavenLocal()
      mavenCentral()
  }
  
  dependencies {
      compile project(':relatedProjects:subprojectB:library')
      compile project(':relatedProjects:subprojectA:library')
  }
  </code></pre>
  
  <p>rootProject settings.gradle</p>
  
  <pre><code>include ':mainProject'
  include ':relatedProjects:subprojectB:library'
  include ':relatedProjects:subprojectA'
  </code></pre>
  
  <p>rootProject build.gradle</p>
  
  <pre><code> buildscript {
       repositories {
           mavenCentral()
       }
       dependencies {
           classpath 'com.android.tools.build:gradle:0.+'
       }
   }
  </code></pre>
  
  <p>subprojectA settings.gradle</p>
  
  <pre><code>include ':library'
  include ':relatedProjects:subprojectAA'
  include ':relatedProjects:subprojectAB'
  </code></pre>
  
  <p>subprojectA  build.gradle</p>
  
  <pre><code>apply plugin: 'android-library'
  
  repositories {
      mavenCentral()
      flatDir {
          name 'localRepository'
          dirs 'src/main/libs'
      }
  }
  
  android {
      compileSdkVersion 19
      buildToolsVersion "19.0.0"
  
      defaultConfig {
          minSdkVersion 9
          targetSdkVersion 19
      }
      sourceSets {
          instrumentTest {
              assets.srcDirs = ["src/tests/assets"]
              res.srcDirs = ["src/tests/res"]
              resources.srcDirs = ["src/tests/src"]
              java.srcDirs = ["src/tests/src"]
          }
      }
  }
  
  dependencies {
      compile project(':relatedProjects:submoduleAA')
      compile project(':relatedProjects:submoduleAB')
  }
  </code></pre>
  
  <p>But when i try to build ./gradlew assembleDebug
  i receive error every time </p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * Where:
  Build file   '.../ProjectRootDir/relatedProjects/submoduleA/library/build.gradle'   line: 38
  
  * What went wrong:
  A problem occurred evaluating project ':relatedProjects:submoduleA:library'.
  &gt; Project with path ':relatedProjects:submoduleAA' could not be found in project     ':relatedProjects:submoduleA:library'.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to     get more log output.
  </code></pre>
  
  <p>line 38 is </p>
  
  <pre><code>       compile project(':relatedProjects:submoduleAA')
  </code></pre>
  
  <p>but when i run ./gradlew assembleDebug for submoduleA project everything is ok.</p>
  
  <p>Every one please help me. How i can use one project with sub projects in another project as sub project(sub module)? </p>