Ten Tools to Simplify Your Development Life - The Part of Tens - Android Application Development For Dummies, 3rd Edition (2015)

Android Application Development For Dummies, 3rd Edition (2015)

Part V. The Part of Tens

Chapter 22. Ten Tools to Simplify Your Development Life

As a developer, you inherently build tools to become more productive — for example, to assist in asynchronous communication, XML and JSON parsing, date and time utilities, and much more. Before you write a ton of helper classes or frameworks to handle items for you, seek out tools that already exist. This chapter lists ten tools and utilities that can simplify your development life by increasing your productivity and ensuring that your app is up to snuff.

Android Lint


If you’ve done other non‐Android development, you may be familiar with the concept of lint tools, which helps you find the “lint” that collects around your code. Lint helps you flag code that may technically run, but it may not be doing exactly what you think it may be doing. Android lint is a sort of warning system on steroids for Android code. To run it, go to Android Studio and choose Analyze⇒Inspect Code. To run it from the command line, use the gradle target check; for example, ./gradlew check.

Android Systrace


Are you interested in finding out why your app is so slow? Chances are that you are, or at least you should be. Android’s Systrace tool can be instrumental to rooting out the causes of poor performance. Using it, you can get very detailed information about what your app is doing at any given time, an example of which is in Figure 22-1:


Figure 221: Example output from Android Systrace.

RoboGuice and Dagger


No, RoboGuice isn’t the latest and greatest energy drink marketed to ­developers — it’s a framework that uses the Google Guice library to streamline dependency injection. Dependency injection handles the initializing of variables at the right time so that you don’t have to. This concept cuts down the amount of code you have to write overall, and it makes maintaining your application a breeze. Where RoboGuice focuses on ease of use, Dagger is another popular dependency injection library focused primarily on speed.

Translator Toolkit


If you want to increase the number of people who can use your app, there’s almost no better way to do it than to translate your app into other languages. The answer is to use Google to find helpers to translate your app for you. The translations aren’t as clean as if you found a native speaker to translate for you, but they’re a great place to start on the cheap. You might consider getting the initial translations done by Google, then reaching out to your user community to find volunteers to edit the translations for you, or using an outsourcing website such as ODesk to find translators. Even craigslist can be a great resource!

Hierarchy Viewer


Working with various views inside the layout file to create a user interface isn’t always a straightforward process. Hierarchy Viewer, located in the Android Device Monitor, lets you see exactly how your widgets are laid out onscreen graphically. This format lets you clearly see a widget’s boundaries so that you can determine what’s going on inside the layout. Hierarchy Viewer, the ultimate tool to make a pixel‐perfect user interface, also lets you magnify the display in the pixel‐perfect view to ensure that images and UIs display flawlessly on all screen sizes and at all densities.

UI/Application Exerciser Monkey


Don’t worry: The UI/Application Exerciser Monkey doesn’t need to be fed bananas to remain happy! You use Exerciser Monkey to stress‐test your application. It simulates random touches, clicks, and other user events to ensure that abnormal usage doesn’t make the app explode. Exerciser Monkey can be used to test apps on either your emulator or your own device.

Git and GitHub


Git — a superfast, free, and open‐source‐distributed version control system — manages repositories quickly and efficiently, making it painless to back up work. Don’t let a system crash ruin your day by not having a version control system for your next spectacular app. Git makes working with branching simple and effective, and it integrates into your workflow easily. Although Git is distributed, you’ll likely want a remote location where the Git repository is stored. You can obtain a free, private Git repository from http://bitbucket.org. If your code is open source, you can create free repositories on Github.com , where there is a huge community of open source developers contributing to each other’s open sourced projects. Also, the Github Android app is open source (see Chapter 21) and worth a good browse.

Picasso and OkHttp


Images add much‐needed context and visual flair to Android applications. Picasso allows for hassle‐free image loading in your application — often in one line of code! You’ve already seen Picasso in use in the Tasks app in Chapter 9, but there’s much more it can do for you in your other apps.

Picasso is built on OkHttp, which makes uploading and downloading information over http significantly easier than the built‐in libraries included with Android.

Memory Analyzer Tool


Java does a lot of memory management for you, but that doesn’t mean that you can’t leak memory on Java. In fact, memory leaks on Android are one of the most common ways that long‐running apps can become unstable. The Eclipse Memory Analyzer Tool (MAT) can help you track down the cause of your memory leaks on Android. Visit the link above to get more information about how to use MAT and other tools to investigate your app’s memory usage.



Once you have a source code control system such as Git set up, the next step is to set up a Continuous Integration (CI) server such as Travis‐CI. A CI system such as Travis‐CI automatically builds your app every time you push a new change to GitHub. It also runs your test cases, checks Android lint, and can also build a release version of your app that’s ready to be uploaded to the Google Play Store. Travis‐CI is free for open source projects, but you can also buy a subscription if you want to build your closed source projects.