What is it?

If you’ve ever used Android Studio, you’ve no doubt seen the word Gradle thrown all over.  It’s one of those things that seems really important even though you don’t know much about it.  And if you are anything like me, you kind of just hope it will keep working…whatever it is.  I’m going to clear up what Gradle is, why it is so important, and why you don’t need to live in fear of it anymore.

What is it?

According to Wikipedia,

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL)…”

While accurate, it’s still a little cryptic and it sure doesn’t make Gradle look any less scary.  Let’s break this down further.

Gradle is open source

Open source simply means that the source code that makes up the program is available for free to whoever wants it and they can do whatever it is they want with it.  This is as opposed to closed source which is what commercial software is; the code is private to the company that created it.

Gradle is a build automation system…

In software, a build is just as it is in any other part of life; the construction of a tangible object.  But in software development, the tangible product is the piece of software which is made of many other files like the source code.  When put together in the correct order, these files come together to make an executable program, more commonly known as an app.

With just a build system, the developer has to manually compile all of the files.  This isn’t so much of a task with small programs with just a few source files, but as programs grow larger and larger and require more resources like images, sounds, screen layouts, etc., it becomes a lot of work to compile a program.  This is where the automation comes in to play.

Believe it or not, a lot of work goes in to combining all of these files to make a program run.  And before these processes could be automated, instructions had to be written by the developer on how to compile the program and this was not done with a nice code editor like Android Studio.  By automating this process, human error is removed and production time is greatly sped up.  Think how many times you hit that play button in a single sitting!

…Builds upon the concepts of Apache Ant and Apache Maven…

Ant is a command-line build system written in java that can be used to build non java applications like C or C++.

Maven is another build automation system meant for any java based project.  Maven’s main goals are to create easy, uniform build systems in the most productive way possible.  Sounds pretty good right?

So basically we have these two tried and true systems that build java apps, now let’s make Gradle improve on them.

…Introduces a Groovy-type…

Groovy, like java, is an object oriented programming language that is meant to work with other java code and libraries.  It omits the commonly used parentheses and periods from java syntax which results in a very human readable context.

…domain specific language (DSL)…

A domain specific language is a programming language made for a specific purpose which in this case is Android development.  So a Groovy-type domain specific language means an object oriented programming language made specifically for the Android platform.  Kind of cool, huh?

So if we were to make the Wikipedia definition simpler, we could say that Gradle is a tool that creates our app using all of the files we have created for it based on methods proven to work by similar tools before it.

That’s a little easier right?

Why two Gradle files?

1I’m sure you’ve noticed by now that there are two Gradle files inside of you Android Studio project, one with the description of “Project” and one with the description of “Module”.  When you start your Android Studio project, you start it with one module.  A single Android studio project can have multiple modules.  Therefore the Project Gradle file are the build instructions for the whole app and the Module Gradle file are the build instructions for just one module of your app.







Hopefully that clears up a little bit about what Gradle is.  It doesn’t have to be as scary as you may think it is and maybe now you’ll have an introductory understanding in why it is there.  However there are all sorts of things you can do with it.  Configuring Gradle builds allows you to create free and paid versions of your app, debug and release versions, and much more.  But alas, that is content for another day.


Leave a Reply

Your email address will not be published. Required fields are marked *