Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Expert Android Programming

You're reading from   Expert Android Programming Master skills to build enterprise grade Android applications

Arrow left icon
Product type Paperback
Published in Sep 2017
Publisher Packt
ISBN-13 9781786468956
Length 404 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Prajyot Mainkar Prajyot Mainkar
Author Profile Icon Prajyot Mainkar
Prajyot Mainkar
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Understanding the Gradle System FREE CHAPTER 2. Exploring Android Studio Developer Tools 3. Leap into the Android Support Library 4. Google Play Services 5. Material Design 6. SOLID Android Development and Its Design Principles 7. Understanding MVC, MVP, MVVM and Clean Arch Patterns 8. Decision Making 9. Performance Matters 10. Building Restaurant finder 11. Backend Service 12. App Quality Service 13. Grow Up 14. Testing 15. Preparing for Google Play 16. Understanding App Store Analytics for Optimization

Stepping into the Gradle world

Gradle is an open source build automation system that is based on the Apache ANT and Maven concept. It introduces a Groovy-based Domain Specific Language (DSL) instead of the XML which is primarily used by Apache Maven for declaring the project configuration. Gradle was designed keeping in mind the support for multi-project builds which grow to be quite a large size, and it supports incremental builds. Gradle does this by understanding which parts of the build tree are up to date.

This ensures that tasks dependent on those parts will not be re-executed. Gradle determines which tasks need to be run and in which order, using Directed Acyclic Graph (DAG).

Gradle can automate the building, testing, publishing, deployment, and more of software packages or other types of projects. Using the combination of the power and flexibility of ANT and the dependency management and conventions of Maven, Gradle helps to build in a more effective manner.

First, let's get familiarized with the Gradle environment inside Android Studio. To do that we should first create a new Android Project. I assume you have Android Studio installed by now. Here is the link in case you wish to know more about the install: https://developer.android.com/studio/install.html

Now that you have the Android Studio installed, we will first create a new project,

Open Android Studio, create a New Project, and give a name to your project as seen in the following figure:

At the Target Android Devices screen, without making any changes, just click on Next:

Next, at the Add an Activity to Mobile screen, select the Empty Activity option for now:

Now, the Activity and an XML file will be generated by default. Just click Finish when done:

When the project load is complete, just change the view structure to Project. You may leave it at Project Files by default:

Once this is done open the build.gradle file. Here you will see the libraries that are compiled in the project:

We have completed the launch of a blank project and we now should understand the basic setup of the same. In the next section, we will talk about adding Gradle to this app.

You have been reading a chapter from
Expert Android Programming
Published in: Sep 2017
Publisher: Packt
ISBN-13: 9781786468956
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime