1. Lets Meet the Android
Abstract
Android mobile phones dominate the mobile smartphone market, surpassing even Apples iPhone. There are hundreds of millions of mobile phones using the Android operating system in over 190 countries around the world. Every day, a million new users begin using their Android phones to surf the Web, to e-mail friends, and to download apps and games. In fact, in the Google Play Store alone, there are 1.5 billion downloads per month of Android games and applications. If you include other web sites that offer Android games and apps for sale, such as Amazon Appstore for Android, then the number is even higher.
Android mobile phones dominate the mobile smartphone market, surpassing even Apples iPhone. There are hundreds of millions of mobile phones using the Android operating system in over 190 countries around the world. Every day, a million new users begin using their Android phones to surf the Web, to e-mail friends, and to download apps and games. In fact, in the Google Play Store alone, there are 1.5 billion downloads per month of Android games and applications. If you include other web sites that offer Android games and apps for sale, such as Amazon Appstore for Android, then the number is even higher.
In this chapter, you will learn about the Android Software Development Kit (SDK). You will learn how to set up the Android development environment. You will also learn about the major components of this environment, such as Eclipse. We then go through the creation and deployment of a simple Hello World program for Android, to both a virtual Android emulator program and also a real Android device.
Overview of Android
The Android operating system is a widely used operating system available on mobile phones and tablets. It is even used on a video game console called the Ouya. Android phones range from expensive phones that require a contract to inexpensive prepaid phones that do not require any contract. Developing programs for the Android platform does not require any developers fees, unlike Apple mobile devices, which require yearly fees in order to even be able to run your program on their devices. A good working prepaid no-contract Android phone that can develop 3D games using OpenGL ES 2.0 can be bought on Amazon.com for as little as $75$100 with free shipping.
Overview of the Android SDK
This section discusses the Android SDK. Development system requirements and important individual pieces of the SDK, such as the SDK Manager, Android Virtual Device Manager, and the actual Android emulator will be covered.
Android Software Development Kit (SDK) Requirements
Android development can be done on a Windows PC, Mac OS machine, or a Linux machine. The exact operating system requirements are as follows:
Operating Systems:
Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
Mac OS X 10.5.8 or later (x86 only)
Linux (tested on Ubuntu Linux, Lucid Lynx)
GNU C Library (glibc) 2.7 or later is required.
On Ubuntu Linux, version 8.04 or later is required.
64-bit distributions must be capable of running 32-bit applications.
Developing Android programs also requires installation of the Java Development Kit. Java Development Kit requirements are JDK 6 or later and are located at www.oracle.com/technetwork/java/javase/downloads/index.html .
If you are using a Mac, then Java may already be installed.
The Eclipse IDE program modified with the Android Development Tools (ADT) plug-in forms the basis for the Android development environment. The requirements for Eclipse are as follows:
Eclipse 3.6.2 (Helios) or greater located at http://eclipse.org
Eclipse JDT plug-in (included in most Eclipse IDE packages)
Android Development Tools (ADT) plug-in for Eclipse located at http://developer.android.com/tools/sdk/eclipse-adt.html
Notes
Eclipse 3.5 (Galileo) is no longer supported with the latest version of ADT. For the latest information on Android development tools, go to http://developer.android.com/tools/index.html .
Android SDK Components Overview
The different components of the Android SDK are the Eclipse program, the Android SDK Manager, and the Android Virtual Device Manager and emulator. Lets look at each in more detail.
Eclipse with Android Development Tools Plug-in
The actual part of the Android SDK that you will spend most of your time dealing with is a program called Eclipse, which is customized specifically for use with Android through the ADT software plug-in. You will enter new code, create new classes, run programs on the Android emulator and on real devices from this program. On older, less capable computers, the emulator may run so slowly that the best option would be running the program on an actual Android device. Because we are dealing with CPU-intensive 3D games in this book, you should use an actual Android device to run the example projects (see Figure ).
Figure 1-1.
Eclipse with Android Development Tools plug-ins
Android SDK Manager
The Android SDK Manager allows you to download new Android platform versions and tools through its interface. Current tools and platform versions that are installed are also displayed. For example, in Figure , the Android 2.2 platform has already been installed and is ready for use for development. This means that you can compile your source code to target this platform.
Figure 1-2.
The Android SDK Manager
Android Virtual Device
The Android SDK also supports a virtual device emulator (see Figure indicates that there is a valid virtual Android device named Android22, which emulates the 2.2 version of the Android operating system (API Level 8) and simulates the ARM CPU type. The 2.2 version of the Android operating system is important because it is the first version that supports OpenGL ES 2.0, which we will be using in this book to develop our 3D graphics. OpenGL is the graphics system that allows the programmer to create 3D graphics on the Android platform. It is designed to be hardware-independent. That is, OpenGL graphics commands are designed to be the same across many different hardware platforms, such as PC, Mac, Android, etc. The OpenGL 2.0 version of OpenGL is the first version of OpenGL that includes programmable vertex and fragment shaders. OpenGL ES is a subset of regular OpenGL and contains fewer features.
Figure 1-3.
The Android Virtual Device Manager
Figure depicts the actual emulator after it is launched. The emulator depicted is the one for version 2.2 of the Android operating system.