Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Android Application Development with Maven
Android Application Development with Maven

Android Application Development with Maven: Learn how to use and configure Maven to support all phases of the development of an Android application

Arrow left icon
Profile Icon Papapetrou Profile Icon LALOU
Arrow right icon
Can$12.99 Can$33.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (1 Ratings)
eBook Mar 2015 192 pages 1st Edition
eBook
Can$12.99 Can$33.99
Paperback
Can$41.99
Subscription
Free Trial
Arrow left icon
Profile Icon Papapetrou Profile Icon LALOU
Arrow right icon
Can$12.99 Can$33.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (1 Ratings)
eBook Mar 2015 192 pages 1st Edition
eBook
Can$12.99 Can$33.99
Paperback
Can$41.99
Subscription
Free Trial
eBook
Can$12.99 Can$33.99
Paperback
Can$41.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Android Application Development with Maven

Chapter 2. Starting the Development Phase

In the previous chapter, we saw how to install a complete work area to develop an Android application, using Maven as the build and project management tool. In this chapter we will see how to take advantage of Maven during the development phase.

Reminders about Android projects

Before diving deeper into the subject, let's review some concepts and rules related to Android.

At first glance, an Android project looks like any other Java project. Yet, some differences are fundamental.

An Android project is made of sources (Java, XML, and property files) and code that is generated by the system. All of these are compiled into bytecode and compressed as an Android PacKage (APK) file. Some Android projects also can produce AAR files but we will have the chance to learn more about this in a following chapter.

Let's open the Android project we have created in the previous chapter, using an artifact. As seen, the hierarchy of folders and files is as following:

  • assets/: This will be reviewed later.
  • res/: This is a set of resources.
    • res/drawable-*pi/*.png: Due to the strong fractionation of Android system, and the high variety of devices, resources such as pictures, fonts, and so on have to be taken into account while releasing. Unless...

Creating an AVD

Before running any application, you have to create an Android Virtual Device (AVD), a kind of software emulator for Android device. Alternatively, you can run directly on a physical device (phone, tablet, and watch), which is actually faster. However, creating AVD instances allows you to test your application in a variety of configurations (OS version, screen size, memory, and so on) which is almost impossible to do with real devices. You can perform this operation via the Graphical User Interface (GUI), or in command line. Both produce the same result.

With the GUI

To run the AVD Manager in windows, you need to execute the AVD Manager.exe file located in the $ANDROID_HOME root; Linux users need to navigate to their SDK's tools/ directory and execute:

$ android avd

When you see the dialog—the list probably contains no emulators – click on New to add a new AVD. Fill out the fields relating to the device you want to emulate, as shown in the following screenshot...

Develop and Build

Now that we have learned how to manage emulators and we have understood the typical Maven project structure and the basic configuration settings found in pom.xml file, we are ready to start developing our simple application. Remember that this book's purpose is not to teach how to code in Android SDK, but to explain how you can effectively use maven to speed up the development process. We will explain the required Maven commands but we will not focus on a particular IDE. Each IDE has its own way of creating Maven command executions and it's out of the scope of this book. You can experiment with your favorite IDE but in any case, if you want to master Android Maven development you should be able to at least run all Maven commands from a terminal window, like that discussed in the following sections and throughout this whole book.

Cleaning

Our first step is to clean the project from any generated source code or other artifacts. Typically, the Maven clean goal is...

Architecture principles

Now that we are able to build and deploy on an AVD, let's resume the development phase itself.

Standalone application

In "simple cases", the Android application has no contact with any other tier. The application is self-dependent. Therefore, the principles of architecture common to any other standalone application apply.

The application has to be divided based on functional criteria, for instance: domain or model, Data Access Object (DAO), service, and view. In Android terminology, views are activities. A graph of direct dependencies is shown in the following image:

Standalone application

In other terms, the view may have direct access to the services, but not to the DAO layer. Yet, any layer is aware of the model.

This best practice allows developing many applications built on common basic blocks, with a frontend and a behavior being totally different.

The management of external dependencies is regular: dependencies are defined mainly by the triplet groupId, artifactId, and...

Summary

Thus, in this second chapter, we learned or revised concepts related to Android SDK and tools. We reviewed how to create AVDs in the GUI and in the command line. We saw how to start/stop an emulator from Maven, and how to clean, build, deploy, and undeploy an APK onto an emulator. Finally, we described best practices in the architecture of Android projects managed by Maven.

In the next chapter, we will begin exploring unit testing.

Left arrow icon Right arrow icon

Description

Android Application Development with Maven is intended for Android developers or devops engineers who want to use Maven to effectively develop quality Android applications. It would be helpful, but not necessary, if you have some previous experience with Maven.

What you will learn

  • Integrate Maven with your favorite Android IDE
  • Install and configure Maven with your local development environment
  • Create the proper Maven structure for both standalone Android applications or applications that are part of a bigger project
  • Run unit tests using popular frameworks such as Robolectric and collect coverage information using Maven plugins
  • Configure a variety of different tools such as Robotium, Spoon, and Selendroid to run integration tests
  • Handle dependencies and different versions of the same application
  • Manage and automate the release process of your application inside/outside Google Play
  • Discover new tools such as Eclipse, IntelliJ IDEA/Android Studio, and NetBeans, which perfectly integrate with Maven and boost your productivity

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 19, 2015
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781783986118
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Mar 19, 2015
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781783986118
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 103.98
Android Application Development with Maven
Can$41.99
Mastering Apache Maven 3
Can$61.99
Total Can$ 103.98 Stars icon
Banner background image

Table of Contents

8 Chapters
1. Beginning with the Basics Chevron down icon Chevron up icon
2. Starting the Development Phase Chevron down icon Chevron up icon
3. Unit Testing Chevron down icon Chevron up icon
4. Integration Testing Chevron down icon Chevron up icon
5. Android Flavors Chevron down icon Chevron up icon
6. Release Life Cycle and Continuous Integration Chevron down icon Chevron up icon
7. Other Tools and Plugins Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(1 Ratings)
5 star 0%
4 star 100%
3 star 0%
2 star 0%
1 star 0%
Luca Morettoni Jun 26, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Java and Maven are strongly coupled, if you have worked for medium (or big) Java projects you will have used Maven!Maven has an huge number of plugins that help you on all process of application release, from testing to final packaging, the only price you need to pay is the configuration file that need to be written in XML (yes, I don't like XML).Recently Google moved the Android app building system to Gradle, that is a great tool: it can use the Maven repositories and the migration is not complicated, but the problem is that you need to migrate and learn a new system!This book is a perfect reference if you need to develope an Android application and you want (or you need) use Maven! Is full of real examples, and the authors drives you to create a pom file for a real application, giving you hints about useful plugins and configuration! Personally I didn't like so much the chapter about the IDE integration, looks like it was written much quickly compared to the other sections of the book.If you need to read (or learn) about Maven and Android project this book is for you!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.