Sunday 31 January 2016

Android gradle, what is it?




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


Answer



Gradle is software for building software.



Let's assume for the moment, given 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.



No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...