I have a multi-project Android build system. The structure of the project is as follows:
Root Dir
|
settings.gradle
|
build.gradle
|
Apps
|
app 1
|
build.gradle
|
app 2
|
build.gradle
|
Libs
|
lib 1
|
build.gradle
|
lib 2
|
build.gradle
All the apps and libraries have common android configration.
At the Root level build.gradle I have the following:
subprojects {
apply plugin: 'android'
android {
compileSdkVersion "Google Inc.:Google APIs:19"
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
}
Next I thought of adding the following to the build.gradle in app 1
apply plugin: 'com.android.application'
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
I get the following error:
Cannot add extension with name 'android', as there is an extension already registered with that name.
In the gradle plugin for android, is there a way to have a "master android configuration" which can be extended by a sub-module?
I had a similar problem - and it has to do with how you are including your plugins.
In your "root" build file you have:
apply plugin: 'android'
In your app you have:
apply plugin: 'com.android.application'
Change the root to match the app plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With