O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Android Application Development with Maven

Book Description

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

In Detail

Android is an open source operating system used for smartphones and tablet computers. The Android market is one of the biggest and fastest growing platforms for application developers, with over a million apps uploaded every day.

Right from the beginning, this book will cover how to set up your Maven development environment and integrate it with your favorite IDE. By sequentially working through the steps in each chapter, you will quickly master the plugins you need for every phase of the Android development process. You will learn how to use Maven to manage and build your project and dependencies, automate your Android application testing plans, and develop and maintain several versions of your application in parallel. Most significantly, you will learn how to integrate your project into a complete factory.

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

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Android Application Development with Maven
    1. Table of Contents
    2. Android Application Development with Maven
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Beginning with the Basics
      1. Installing Java
      2. Download and Install Apache Maven
      3. Android SDK
        1. Android development tools
        2. Android SDK standalone
      4. Creation of a new project
      5. Integration with IDE
        1. Eclipse
          1. Set up and integration of Maven and Android SDK
          2. Creation of a project in Eclipse
        2. IntelliJ IDEA / Android Studio
          1. Set up and integration of Maven and Android SDK
            1. Specific to Android Studio
            2. Specific to IntelliJ IDEA
          2. Import of project
            1. Specific to Android Studio
            2. Specific to IntelliJ IDEA
        3. NetBeans
          1. Set up and integration of Maven and Android SDK
          2. Import a project
      6. Summary
    9. 2. Starting the Development Phase
      1. Reminders about Android projects
      2. Creating an AVD
        1. With the GUI
        2. In-command line
      3. Develop and Build
        1. Cleaning
        2. Generating sources
        3. Build
        4. Emulator
          1. Start
          2. Stop
          3. Stop all
          4. Deploy
          5. Undeploy
      4. Architecture principles
        1. Standalone application
        2. Android application within an n-tier architecture
        3. Android with dependencies on SDK Add-ons
      5. Summary
    10. 3. Unit Testing
      1. Effectively testing Android applications
      2. Running typical unit tests
      3. Unit testing of activities
        1. Creating a dedicated unit testing module
        2. Running Android unit tests with Maven
      4. Real unit testing with Robolectric
        1. Configuring Robolectric with Maven
        2. Running Robolectric unit tests
        3. Best approach
      5. Measuring test coverage
        1. JaCoCo
        2. Cobertura
      6. Summary
    11. 4. Integration Testing
      1. Fundamentals of instrumentation testing
      2. Running Android instrumentation tests
        1. Creating a dedicated integration testing module
        2. Writing a simple instrumentation activity test
      3. Grabbing screenshots with Spoon
        1. Configuring Spoon with Maven
        2. Running Spoon and viewing the reports
      4. Working with Robotium
      5. UI Tests made easy with Selendroid
        1. Configuring Selendroid
        2. Writing Selendroid UI Tests for Maven native applications
      6. Other integration testing tools
      7. Summary
    12. 5. Android Flavors
      1. Problem statement
      2. Introducing Maven profiles
      3. Creating build profiles
        1. Separation by packaging
        2. Separation by library
      4. Summary
    13. 6. Release Life Cycle and Continuous Integration
      1. Optimizing an Android package
        1. Signing an application
        2. Obfuscating the code
        3. Aligning and zipping uncompressed data
        4. Transforming the package in shippable form
      2. Releasing a new version
        1. Perform a release without deployment to repository
        2. Deploying to a local repository
      3. CI and automation best practices
      4. Summary
    14. 7. Other Tools and Plugins
      1. Managing Android code quality
        1. A short history about quality in Android
        2. Analyzing with Lint using Maven
        3. Unleashing the power of SonarQube
      2. Boost development speed with GenyMotion
        1. Deploying our example to a GenyMotion emulator
      3. Summary
    15. Index