Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 315
znat Avatar asked Nov 18 '25 20:11

znat


1 Answers

Your MainProject/settings.gradle should have

include 'ModuleProject', 'ModuleProject:SubmoduleProject'

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

like image 169
Radim Avatar answered Nov 20 '25 16:11

Radim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!