如何在Android Studio中嵌套模块

时间:2014-04-15 21:04:42

标签: gradle android-studio

我正在尝试使用以下结构构建项目。它是一个使用另一个库(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抛出以下错误:

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

如何使用嵌套库构建项目?

1 个答案:

答案 0 :(得分:0)

您的MainProject/settings.gradle应该

include 'ModuleProject', 'ModuleProject:SubmoduleProject'

,依赖关系将为compile project(':ModuleProject:SubmoduleProject')