I have 2 Android apps with 5 Android modules (Android library project). Total 7 Eclipse projects. I want to enable Gradle build for them. I added build.gradle
in the root folder and listed all project in settings.gradle
include ':app1'
include ':app2'
...
However I discovered that I need to copy-paste section below in every one of 7 project
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 1
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
... // and so on like source folders configuration
}
Reason: when I add apply plugin: 'android'
inside root build.gradle
(see Could not find method android() in root of multimodule project),
then I can't apply plugin: 'android-library'
for libraries projects (see https://stackoverflow.com/questions/23864292/minimal-gradle-configuration-for-android-library-in-multimodule-project)
But it is what I want to avoid, having different version of Android and Android tools specified in different places.
How can I minify this configuration to have as many things as possible in one build.gradle
config file.