Chapter 12. Building tools

 

Building software applications often requires custom processes such as adding dependencies, running tests, and deploying in a server. If building from Eclipse feels a bit limiting, you’ll find this chapter interesting. We’ll cover tips that provide some alternatives for building your applications.

Hack 48 Handling dependencies with Apache Maven: Android v1.6+

The Android SDK comes with a lot of classes and code that help you create your applications, but sometimes even this isn’t enough. For example, if you want to add Google Analytics or you want to add a JSON parser, you’ll have to add some kind of dependencies. The Android SDK doesn’t provide a way to handle dependencies, other than placing JAR files in the /libs folder. Fortunately, it has other building tools. Even if you don’t use third-party dependencies, you might want to separate your application in different modules and add dependencies between them in order to organize your code or create reusable components. What you can do to get around this issue is to use Apache Maven. In this hack you’ll see how to use Apache Maven to build your application and run tests.

If you’ve used Maven for Java application dependencies, you’ll agree that it’s a powerful tool, but it takes some time to get used to it. In this case, we’ll take a look at Manfred Moser’s roboguice-calculator demo. In this project, Manfred used different dependencies, making it an excellent example to demonstrate how Maven works.

Hack 49 Installing dependencies in a rooted device: Android v1.6+

Hack 50 Using Jenkins to deal with device diversity: Android v1.6- 6+ Contributed by Christopher Orr