HotIceCream HotIceCream - 1 year ago 101
Android Question

How to define common android properties for all modules using gradle

I create a simple project in AndroidStudio with a few modules. Each module's gradle script contains the following code:

android {
compileSdkVersion 18
buildToolsVersion "18.1.1"

defaultConfig {
minSdkVersion 7
targetSdkVersion 18

How can I move this code to the main build.gradle script (project's script)? This code is common for all the submodules.

Answer Source

In build.gradle of main project you should write something like next:

project.extensions.add("buildToolsVersion", "19.0.3")

In subproject you can use this extensions:

buildToolsVersion rootProject.buildToolsVersion

More info you can find here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download