With sales of Android devices growing, there’s no better time to get started crafting your first Android app. Here are the five things you need to know before creating that first killer app.
1. Understand the Java Programming Language. Java is Android’s main programming language. Learn object-oriented programming concepts, Java language fundamentals, including packages, classes and objects, interfaces and inheritance, numbers and strings, Generics, Collections, and concurrency. The more you understand Java, the more robust and elegant your Android apps will be. The best-selling book Head First Java is a great place to start learning the fundamentals.
2. Choose Your Development Environment and Tools. Get familiar with the integrated development environment and the build automation tools. For development tools, you can use Eclipse, or the newer Android Studio IDE. Both are free. In Developing with Eclipse, from Android Developer Tools, you’ll learn about the basics about Eclipse and many ways to use IDE to improve your code.
For build automation, learn Apache Ant, Apache Maven, and Gradle, which provide a robust set of tools to manage your builds. Finally, get familiar with source control concepts and tools: learn git and create a git-source repository by creating an account on GitHub or Bitbucket. The Git Pocket Guide will help you understand the basic terms and concepts of how the platform operates.
3. Be Aware of Fragmentation. Given Google’s philosophy with respect to openness, Android is a fragmented market with its different OS versions and devices. Keep in mind that the more versions and devices your app supports, the more testing and maintenance (and related costs) that you will have.
The Gingerbread (introduced in 2011) version of Android still commands 20% of the Android device distribution. The market, however, is consolidating on Android 4.x and newer (this represents the last three major Android releases). Smartphones, tablets, and hybrid “phablets” each have different sizes and resolutions. You’ll need the appropriate assets, fonts and layouts that ensure the best possible experience across such different screen characteristics. See Design Apps for Tablets from the Android Developers Blog.
You also need to consider the array of Android supported sensors and/or UI facilities. For example, not all Android devices may support the same kind of camera, and they may not support Bluetooth. A good example is the Kindle, which is based on Android 2.3, but it doesn’t provide support for many of the hardware sensors or UI facilities found on other Android devices.
5. Learn About Threads, Tasks, and Loaders. Delivering a “great user experience” is the golden rule on mobile, so the main system (user interface) thread must never be blocked to ensure a great and smooth user interface. So, long operations (network, I/O, computations) must all be run asynchronously in the background, typically on a different thread of execution. For this, you must learn the Java language concurrency facilities. Read about thread and synchronization in Java: A Beginners Tutorial:
You’ll also want to understand Android’s own facilities that allow parts of your app to run asynchronously in the background. This chapter from Pro Android 4 will walk you through building your first AsyncTask:
Special thanks to C. Enrique Ortiz for his help in writing this blog post. Ortiz (@eortiz) is a well-known expert and author on mobile software development.