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.

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  en.wikipedia.org/wiki/Gradle

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 https://github.com/spring-guides/gs-gradle-android.git
    cd into gs-gradle-android/initial
    •  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 gradle-1.8-bin.zip. Alternatively, you can choose gradle-1.8-all.zip 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.
    gradle
    • 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
    gradle
    C:gradle-1.11
    path
    %PATH%;%GRADLE_HOME%bin
    • Test the Gradle installation with following command in Command Prompt mode. type: gradle:
    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 
    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
    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.

    Leave a Reply

    avatar
      Subscribe  
    Notify of