Android Studio – All You Have To Know About Gradle.

Google has announced Android Studio as official IDE for android app development. And as you might have woke up from a slumber, like I did, and realized that switching from Eclipse IDE to Android Studio would require a know how of gradle configuration. Its a bit tricky but not as bad as it might seem.

What exactly is gradle?

Gradle is an advanced build toolkit that manages dependenccies and allows you to define custom build logic.

So whats with android?

There is an android plugin for gradle configuration for managing different build configuration of android projects. Android plugin for gradle is independent of android studio and hence can be used from command line as well.

So whats different gradle than default build in eclipse?

Build configuration is defined in build.gradle file. One can define many build variants for different configurations of the same module. There also can be multiple variants of the manifest file for the same variant. There are two gradle configurations to be created: 1. Project/App Confguration (located at project root folder) 2. Module gradle confuguration (located at project_root/app folder) App configuration will have different configurations for the entire application and, for a modules (that is separately buid-able and run-able component) we need to put the configuration code in the module configuration file of the particular app folder. Basic Skeletal of gradle files:

buildscript {
    repositories {
    dependencies {
        classpath ''

        // NOTE: Do not place your application dependencies here: they belong
        // in the individual module build.gradle files

allprojects {
   repositories {

Basic Skeletal of Module configuration:

apply plugin:''
android {
 compileSdkVersion 20
 buildToolsVersion "20.0.0"
defaultConfig {
 applicationId "com.mycompany.myapplication"
 minSdkVersion 13
 targetSdkVersion 20
 versionCode 1
 versionName "1.0"
buildTypes {
 release {
 minifyEnabled false
 proguardFiles getDefaultProguardFile('proguard-android.txt'),''
 debug {
 debuggable true
dependencies {
 compile fileTree(dir:'libs', include:['*.jar'])
 compile ''
 compile project(path:':app2, configuration: 'android-endpoints')

More information about the Android plugin for gradle could obtained from Android Developer website:

More information on gradle itself could be found at:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s