Last Updated on

It’s the new build tool that Google wants to use for Android. It’s being used due to it being more extensible, and useful than ant. It is meant to enhance developer experience.
With Gradle, Android developers can use a simple, declarative DSL to configure Gradle builds supporting a wide variety of Android devices and App stores.

Building Android Projects with Gradle 1

About Gradle:

Gradle is a project automation tool that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the more traditional XML form of declaring the project configuration.
The initial plugins are primarily focused around Java, Groovy and Scala development and deployment, but more languages and project workflows are on the road map. more

Now Let’s Start

What you’ll need to use gradle :

  1. A favorite text editor or IDE
  2. Android SDK
  3. An Android device or Emulator

    Command Line Install Guide :

    Download and unzip the source repository for this guide, or clone it using Git: 
    git clone
    Building Android Projects with Gradle 2
    cd into gs-gradle-android/initial
    Building Android Projects with Gradle 3
    •  Download the latest version of Gradle (1.8 as of this writing) from the {Gradle Downloads} page.
    Note: Only the binaries are required, so look for the link to Alternatively, you can choose to download the sources and documentation as well as the binaries.
    • Unzip the archive and place it in a location of your choosing. For example, you may want to place it in the root Local Disk (C:). See the Installing Gradle page for additional details.
    • Configure the GRADLE_HOME environment variable based on the location where you installed Gradle.
    set GRADLE_HOME=C:gradle-1.11
    set PATH=%PATH%;%GRADLE_HOME%bin
    • Test the Gradle installation with following command in Command Prompt mode. type: gradle:
    Building Android Projects with Gradle 4
    Wellcome to Gradle 1.11
    Now you have successfully Gradle installed.
    When you’re finished, you can check your results against the code in gs-gradle-android/complete.
    Gradle Build Project Structure 
    Building Android Projects with Gradle 5
    Gradle Build Project Structure

    Find out what Gradle can do:

    Before you even create a build.gradle file for the project, you can ask Gradle what tasks are available:
    You should see a list of available tasks. Assuming you run Gradle in a folder that does not contain a build.gradle file, you see basic tasks such as the following:
    Now Write this on Command Prompt . type : gradle tasks See the Result for this
    Building Android Projects with Gradle 6
    gradle tasks
    Even though these tasks are available, they do not offer much value without a project build configuration. As you flesh out the build.gradle file, some of these tasks become more useful. The list of tasks will grow as you add plugins to the build.gradle file. You can run gradle tasks again to see what new tasks are available.

    >Build Android code:

    The most simple Android project has the following build.gradle file.Flowing this file  build.gradlehas depend all of your project structure.

    As an Amazon Associate I earn from qualifying purchases.