我有一个多项目Android构建系统。该项目的结构如下:
Root Dir
|
settings.gradle
|
build.gradle
|
Apps
|
app 1
|
build.gradle
|
app 2
|
build.gradle
|
Libs
|
lib 1
|
build.gradle
|
lib 2
|
build.gradle
所有应用程序和库都有常见的Android配置。
在Root级别build.gradle中,我有以下内容:
subprojects {
apply plugin: 'android'
android {
compileSdkVersion "Google Inc.:Google APIs:19"
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
}
接下来我想到将以下内容添加到app 1中的build.gradle
apply plugin: 'com.android.application'
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
我收到以下错误:
Cannot add extension with name 'android', as there is an extension already registered with that name.
在android的gradle插件中,有没有办法让一个“主机配置”可以通过子模块进行扩展?