Book Image

Mastering Gradle

Book Image

Mastering Gradle

Overview of this book

Table of Contents (17 chapters)
Mastering Gradle
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building the Android project with Gradle


We created the application with one simple activity and now we will try to build the application with Gradle. Android Studio has automatically generated two build files for the project; one build.gradle file in the root folder of the project and other build file in the app directory. We will use the build.gradle file of the subproject (app folder) to build the Android application. This build.gradle file has the following content:

apply plugin: 'com.android.application'

android {
  compileSdkVersion 22
  buildToolsVersion "22.0.1"

  defaultConfig {
    applicationId "ch10.androidsampleapp"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:22.1.1...