我正在组织许多Android Studio项目,构建正在使用gradle。 我目前的计划是:
MainProject:
settings.gradle
include ':SDK:Dependency1'
include ':SDK:Dependency2'
include ':SDK:Dependency3'
include ':SDK:Dependency4'
include "MainProject"
project(":MainProject").setProjectDir(new File("./ProjectName"))
MainProject /的build.gradle
debugCompile project(path: ':SDK:Dependency1', configuration: 'debug')
releaseCompile project(path: ':SDK:Dependency1', configuration: 'release')
debugCompile project(path: ':SDK:Dependency2', configuration: 'debug')
releaseCompile project(path: ':SDK:Dependency2', configuration: 'release')
debugCompile project(path: ':SDK:Dependency3', configuration: 'debug')
releaseCompile project(path: ':SDK:Dependency3', configuration: 'release')
debugCompile project(path: ':SDK:Dependency4', configuration: 'debug')
releaseCompile project(path: ':SDK:Dependency4', configuration: 'release')
我想将其称为aar库,因此我的MainProject / build.gradle正在变为。
compile "com.dependency.sdk.Dependency1:$SDKVersion"
compile "com.dependency.sdk:Dependency2:$SDKVersion"
compile "com.dependency.sdk:Dependency3:$SDKVersion"
compile "com.dependency.sdk:Dependency4:$SDKVersion"
问题是:当我这样做时,构建在配置阶段失败,因为MainProject无法解析依赖关系,因为依赖库尚未构建。
如何在不修改settings.gradle文件的情况下解决这个问题?(我想只有一个settings.gradle文件)。