Akshay
Akshay

Reputation: 903

Android: How To include project in Settings.gradle

Following my project directory structure:

dev/
   android/
           apps/ 
                project2
   project1

I want to include project 1 in my project 2. So I am trying to add this project in my settings.gradle file. Following is the content of my settings.gradle file:

include ‘:project2', ‘dev:project1'
project('../../..project1').projectDir = new File(settingsDir, ‘:project1’)

build.gradle file:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project('../client/project1')
}

When I try to build my project it gives me this error:

Error:Project with path '../../.. project1' could not be found.

Upvotes: 3

Views: 6327

Answers (2)

Akshay
Akshay

Reputation: 903

I solved this problem by using following code in settings.gradle

include ‘:project2', ‘dev:project1'
project(':project1').projectDir = new File(settingsDir, ‘../../../project1’)

build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':project1')
}

Upvotes: 2

Rafael Toledo
Rafael Toledo

Reputation: 5649

Assuming that you have the settings.gradle file placed at root folder:

include ':dev:project1', ':dev:android:apps:project2'

Upvotes: 0

Related Questions