znat
znat

Reputation: 13474

How to nest modules in Android Studio

I am trying to build a project with the following structure. It is an app that uses a library project using another library (Google Volley).

- MainProject
|-- ModuleProject
    |-- SubmoduleProject

ModuleProject/build.gradle

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

apply plugin: 'android-library'

dependencies {
    compile project(':SubmoduleProject')
}

ModuleProject/settings.gradle

include ':SubmoduleProject'

Android studio throws the following error:

Project with path ':SubmoduleProject' could not be found in project ':ModuleProject'

How can I build my project with nested libraries?

Upvotes: 3

Views: 2266

Answers (1)

Radim
Radim

Reputation: 4808

Your MainProject/settings.gradle should have

include 'ModuleProject', 'ModuleProject:SubmoduleProject'

and the dependency will be compile project(':ModuleProject:SubmoduleProject')

Upvotes: 1

Related Questions