Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android gradle, what is it?

Tags:

android

gradle

There are some other related questions in this same website, but I just cannot get my head around this.

In their website they're extremelly abstract.

Gradle is build automation evolved. Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else.

What does that really mean? Thanks

like image 271
frankelot Avatar asked May 22 '14 19:05

frankelot


People also ask

What is a Gradle in Android?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.

What exactly does Gradle do?

Gradle is a build automation tool known for its flexibility to build software. A build automation tool is used to automate the creation of applications. The building process includes compiling, linking, and packaging the code. The process becomes more consistent with the help of build automation tools.

Do I need Gradle for Android studio?

Gradle is one type of build tool that builds the source code of the program. So it's an important part of Android Studio, and needs to be installed before starting developing your application. We do not have to install it separately, because the Android Studio does it for us, when we make our first project.

What is a Gradle file?

A GRADLE file is a script containing the build configuration for an (Android) application written in Java, Kotlin, Groovy, C/C++, or JavaScript programming language. A GRADLE file is used by Gradle build automation, testing, and deployment framework.


1 Answers

Gradle is software for building software.

Let's assume for the moment, given android in your question, that you are working on an Android app.

You may be using Eclipse to develop your app. Eclipse, as part of that, will use its own build automation engine to compile your Java, cross-compile the bytecode into Dalvik bytecode, compile the resources and manifest, package all that up into an APK, sign it with a signing key, and zipalign the results (among other steps).

Instead (or in addition to) Eclipse, you might have used android update project to generate a build.xml file, one that allows your app to be built via Apache Ant. Ant, like Gradle, is a build automation engine -- software for building software. Gradle happens to be newer and more powerful than Ant, but they have the same basic role in our lives: taking all stuff we type in (like, say, Java source) and get an APK out as a result.

If you have used Maven for project builds, or have used other IDEs (e.g., IntelliJ IDEA, NetBeans), you have used their build automation engines as part and parcel of that work.

Gradle is not only available for command-line builds as a replacement for Ant, but it is also the build automation engine used (by default) in Android Studio. Quoting the Android developer documentation:

The Android Studio build system consists of an Android plugin for Gradle. Gradle is an advanced build toolkit that manages dependencies and allows you to define custom build logic. Many software projects use Gradle to manage their builds. The Android plugin for Gradle does not depend on Android Studio, although Android Studio is fully integrated with it. This means that:

  • You can build your Android apps from the command line on your machine or on machines where Android Studio is not installed (such as continuous integration servers).
  • You can build your Android apps from Android Studio with the same custom build configuration and logic as when you build from the command line.

The output of the build is the same whether you are building a project from the command line, on a remote machine, or using Android Studio.

like image 186
CommonsWare Avatar answered Sep 27 '22 18:09

CommonsWare