# Android nested multi project dependency issues

**URL:** <https://discuss.gradle.org/t/android-nested-multi-project-dependency-issues/12670>\
**Category:** Help/Discuss\
**Created:** [November 9, 2015, 8:44am UTC](https://discuss.gradle.org/t/android-nested-multi-project-dependency-issues/12670 "2015-11-09T08:44:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![omar391](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@omar391](https://discuss.gradle.org/u/omar391)\
**Post date:** [November 9, 2015, 8:44am UTC](https://discuss.gradle.org/t/android-nested-multi-project-dependency-issues/12670/1 "2015-11-09T08:44:51Z")

</div>

Hi,

Well, I am new to Gradle world. And for this specific issue of mine, I have traversed StackOverflow threads extensively without no avail. In short, what I want is -

Suppose I have 3 projects namely - A(library project), B(library project), C

- Project A is simple witout no dependencies.
- Project B is dependent on project A
- Project C is dependent on project B

So in B’s settings.graddle file -

> include ‘:ProjA’  
> project(‘:ProjA’).projectDir = new File(‘ProjADirectory’)

And in B’s main module’s build file-

> dependencies {  
> compile project(‘:ProjA’)  
> }  
> And everything works fine for B.

However, when I did similar for proj C (adding B as dependant) it tells me that “:ProjA” is not found. I understand that If I add “:ProjA” in C’s setting file, it will compile ok.

But I want the script to automatically resolve “:ProjA” as B is added as a dependency. Is it possible, somehow?

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [November 10, 2015, 10:03am UTC](https://discuss.gradle.org/t/android-nested-multi-project-dependency-issues/12670/2 "2015-11-10T10:03:12Z")

</div>

Hey,

project dependencies can only be used if all projects are build in one gradle build. This means you need one settings.gradle file (usually on the root level) declaring projects, A, B & C.

Now the transitive dependencies in B to A is resolved when building C.

---

<div class="post-metadata">

**Author:** ![omar391](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@omar391](https://discuss.gradle.org/u/omar391)\
**Post date:** [November 11, 2015, 9:57am UTC](https://discuss.gradle.org/t/android-nested-multi-project-dependency-issues/12670/3 "2015-11-11T09:57:44Z")

</div>

Thanks for your reply. I am already known to your explanation, but I didn’t want to add Proj-A in C’s settings file rather trying to find a way out so that A becomes automatically visible to C’s context. However, I now like to add it programmatically from in B’s build file so eventually C will automatically get it. I guess I will need to open a new post for that.

Regards.
