What is Gradle? Why Google choose it as an official build tool for Android.
Tags: android, computerscience, beginners
Published: 2019-06-30 18:47:13

####Gradle is a Build tool.
But before understanding Gradle, we need to understand what is build tool and why we need one.

>***What is Build Tool?***
>
>*Build tool is a software that helps to automates the process of application creation. Build process incorporates compiling, linking, and packaging the code into executable form.*

**Build tools used to automates tedious tasks like:**

* Downloading dependencies
* Compiling source code into executable code
* Packing that executable code and generate APK or executable form
* Running different tests etc.

*Build tools also called build system.*

In Android, Build system takes all the source files (like `.java`, `.kt`, or `.xml`), then applies appropriate compilation process (like use kotlin compiler for compiling .kt files) and generate an executable package or APK.

Ever you asked yourself why android is so strict for naming the folders. Why every resource goes into a `res` directory, why layouts must go into `layout` the directory, that is because of these build systems. The build system uses some naming convention, they design in such a way that they perform their operations based on that naming convention.

While generating APK, whenever build system needs any resource, It is designed in such a way that it finds that resource in a `res` directory. That’s why android is so strict about naming the directories.

To automate these all tasks we use scripts. You can create your own build system based using shell scripting in Linux and using a batch file in windows.

####Why we need Build Tools?

In small projects, developers can manually create the build process. When only two or three files are there this approach worked. But in large projects this approach cannot be worked, where it is hard to keep track of what needs to be built, in which sequence and what dependencies are there in the building process. That is why we need build tools because they provide much more easy, powerful and faster build process.

##What is Gradle?
---
Gradle is an Open-source build tool. It is written in Java, Groovy and Kotlin. Gradle comprises top features of Apache Ant and Apache Maven. But it is far more fast, flexible and powerful from any of them.

Gradle is a JVM based build system, that means you can write your own scripts in any JVM based language like Java, Kotlin, Groovy, Scala, etc.

Gradle also has counted in the top 20 open-source projects, Tech-Giants like Google, Adobe, LinkedIn, Netflix and elastic used it as a build tool for their projects.

Gradle also supports all major IDEs like Android Studio, IntelliJ, Visual Studio, Eclipse, and Xcode, etc. You can also invoke it via a command line terminal.

##Why Google choose Gradle for android?
---
There are many build systems are there in the market like Maven, Ant, Atlassian Bamboo, CircleCi, TeamCity, Travis Ci, etc.

But Google wants to make the app development process faster and easier, and at that time and today also no one is as fast and flexible as Gradle. And that is why Google choose it for the Operating System that rules 70% of the market the Android.

Google choose it because of three main reasons:

1. Performance
2. Flexibility
3. User Experience

####Performance

![](https://cdn-images-1.medium.com/max/800/1*Hc5O3GSF9VOVaMdnqKV23Q.png)


Gradle is nearly twice fast from Maven in all scenarios and 100x faster for large builds using the build cache. On the above picture, you can see the performance graph of Gradle. It is not just fast it’s super-fast.

####Flexibility
Google choose Gradle not just because it is far faster than others. But the Gradle is also very flexible. Gradle’s model is designed in such a way that it can be expanded to cover any ecosystem.

Gradle is a **plugin based build system.** That means even if you have your own programming language and if you want to automate the task of generating executable from source code then you can write your own plugin in any JVM based language like Java, Kotlin, Scala, Groovy, etc and use it. This makes Gradle much more flexible than others.

####User Experience
For providing better user experience Gradle supports a wide range of IDEs like Android Studio, IntelliJ, Eclipse, Visual Studio, Xcode, etc.

Although IDEs are important, a large number of users still likes to work with terminal. That’s why Gradle provides modern CLI (Command Line Interface) that has several powerful features like ‘Gradle tasks’, command line completion, etc.

Gradle also provides [build scans](https://gradle.com/build-scans/) interactive web-based UI for debugging and optimizing builds.

So, guys, that’s it for a Gradle. Feel free to know me if I missed something.

Till then Keep Coding, Keep Loving, Catch you up in the next article.

Jai Hind, Vande Mataram 🇮🇳

> **_Wanna get in touch with me? Here are the links. I’ll love to become your friend. 😊_**
[My Site] (https://www.jaytillu.in)
[My Blogs] (https://blogs.jaytillu.in)
[Twitter](https://twitter.com/jay_tillu)
[Facebook](https://www.facebook.com/jaytillu.1314/)
[Instagram](https://www.facebook.com/jaytillu.1314/)
[Medium](https://medium.com/jay-tillu)
[LinkedIn](https://www.linkedin.com/in/jaytillu/)
[Github](https://www.github.com/jay-tillu)
[Stack overflow](https://stackoverflow.com/users/8509590/jay-tillu)
or just mail me at jd.tillu@gmail.com