小编Nic*_*sso的帖子

在构建 Android Studio 时排除模块

我有一个 Android Studio 项目,其中包含 3 个模块。A、B、C。A 依赖于 C,B 依赖于 C。我试图加快构建时间,我意识到每次执行 assembleRelease/assembeDebug 任务时,它都会构建所有模块。每次我构建模块 A 应该只构建 A 和 C,因为 B 在那个任务中没有依赖,对吧?如何避免每次构建模块 A 时构建模块 B?

模块 A 依赖项:

dependencies {
    compile project(path: ':c', configuration: 'release')
    provided files('libs/some-lib.jar')
}
Run Code Online (Sandbox Code Playgroud)

模块 B 依赖项:

dependencies {
    compile project(path: ':c', configuration: 'debug')
}
Run Code Online (Sandbox Code Playgroud)

模块 C 依赖项:

dependencies {
    compile files('libs/other-lib.jar')
}
Run Code Online (Sandbox Code Playgroud)

dependencies android build gradle android-studio

4
推荐指数
2
解决办法
2824
查看次数

标签 统计

android ×1

android-studio ×1

build ×1

dependencies ×1

gradle ×1