Learn Gradle | tutorials, and examples

What is Gradle?

Gradle is an Opensource build automation tool to build and run projects in Android and java based on projects.

Features:

  • Incremental builds Gradle considers the last modified files and the last build and only builds with modified files thus improving performance.
  • Parallel task execution
  • Build caching
  • JVM and Android application management

Gradle version

The current version is 7.1.

Gradle Download

The Gradle tool can be downloaded from here🔗. You can check my other post below to check whether Gradle is installed or not.

The Gradle download can be in a binary form or a complete form.

gradle vs maven

There are a lot of differences between Gradle and Maven.

You can check another article difference between Gradle and maven

gradle plugins

Gradle plugins are useful to add extra functionality for tasks, dependency, and configuration values.

Frequently used plugins

  • java plugin
  • maven-plugin
  • android plugin

What is the Gradle wrapper

The Gradle wrapper is a command-line tool to start the Gradle build project.

It contains two batch script files in Gradle-based projects.

  • gradlew.bat for windows
  • gradlew.sh for Linux system

The gradle wrapper allows you to run and build projects without installing them on the local machine.

These gradle wrapper scripts add by default with the Gradle project.

You can still add using the below command.

gradle wrapper --gradle-version 7.1.1

It adds the following files to the project.

└── <project folder>
    └── gradlew
    └── gradlew.bat
    └── build.gradle
    └──
    └──
    └── gradle
        └── wrapper
            └── gradle-wrapper.jar
            └── gradle-wrapper.properties

You can also check a difference between Gradle and gradlew command

Gradle Cheatsheet

ParameterDescription
gradle installs and configureHow to install Gradle on Windows, Linux, and Mac OS, configure environment variables to setup
gitignore Gradle projectHow to add gitignore to gradle projects for android and java projects
Gradle command listIt includes frequently used command build and running java projects
gradle dependency treeIn this tutorial, Different ways to get dependency graph for single and multi-modular Gradle projects
Gradle exclude dependenciesHow to exclude dependencies globally as well as per transitive dependencies
gradle force redownload dependencyIn this tutorial, Learned multiple ways how to remove and update dependencies
gradle ignore test case executionIn this post, You learned different ways to exclude running test cases with all as well as single test cases
Configure JDK version in gradleHow to configure javac source and target java JDK versions in gradle build
Running single test casesDifferent ways to compile and execute single test cases
Difference between gradle and gradlewExplain the main difference between gradle and Gradle wrapper commands
Difference between gradle and mavenExplain the main difference between gradle and maven builds
Permission Denied error in gradleHow to fix permission denied error in Gradle running in Linux and unix
release API in androidIn this tutorial, posted about generating a release signed and unsigned APK file in android apps using Gradle build
gitignore-gradle-projectIn this Section, discussed what not to commit in an android application for a gitignore file during commit to repository