See the main article for more information.
Android™ mobile apps are written in Java® and the Android development tools are based on Eclipse™. To write an Android app, about the only thing you need is a development workstation with your favorite operating system and a Java® Run-time Environment (JRE). The Android SDK relies on some classes found specifically in the Oracle® Java platform. You can try a different JRE, but the Android SDK might be unable to build your app. If you don't already have a JRE, you can get one at http://java.com.
Set up the Android Developer Tools (ADT)
When you develop an Android app, you spend much of your time within the ADT. The first step is to download the ADT and set it up.
Download the ADT
- Point your browser to http://developer.android.com/sdk.
- Select the Download the SDK... button.
- Read the terms and conditions. If you choose to accept them, do so, and proceed to the next step.
- Pick 32-bit or 64-bit. Just make sure you choose the same "bitness" as your JRE, or unpleasant error messages will be hurled at you whenever you try to start the ADT.
- Select the Download the SDK ADT Bundle... button, and save the ZIP file to a temporary folder.
- Extract the contents of the ZIP file to a more permanent folder of your choosing. For example, I extracted the bundle to C:\Users\Administrator\Programs.
Install the ADT Bundle
- Open a command prompt.
- Enter the command
java -fullversionto make sure the JRE you expected is present. Example:
java full version "1.7.0_51-b13"
- Locate the adt-bundle-[platform]/eclipse/ folder relative to where you extracted the ADT bundle, and launch the
eclipseprogram you find there. Example:
- All being well, a Workspace Launcher dialog opens after a few seconds. Choose a folder to contain your project workspace.
- After a few more seconds, the ADT development environment opens and greets you with a hearty "Welcome!" page. Look around all you like, but once you're ready to continue, close the welcome page.
Prepare the Android Virtual Device Manager (AVD)
Fear not, this isn't a doomsday weapon or a cloaking device or anything ominous. The AVD is used to manage – you guessed it – Android virtual devices. An AVD describes a virtual device in the Android Emulator, which is a handy place to run Android apps, especially if you don't have a real Android device on tap.
- From the ADT main menu, select Window > Android Virtual Device Manager.
- Select New... to create a new AVD.
- As shown in the following figure, enter an AVD Name (for example,
ADT1), choose a Device (for example,
Nexus 4 (4.7", 768 x 1280: xhdpi)), and choose a Target (for example,
Android 4.4 – API Level 19).
Beware the Memory Options and the default amount of RAM. If it's greater than 768MB, the emulator might refuse to start, which is exactly what happened to me. Change the amount of RAM to 768, and you should be fine.
Click OK to close the dialog.
- Your new AVD should now be listed in the Android Virtual Device Manager.
List of Android virtual devices
- Select Start... to launch the Android Emulator. Please be patient. It takes several seconds for the emulator window to open, and often takes a few minutes for it to fully initialize itself. If the ADT times out while waiting for the emulator, open Window > Preferences > Android > DDMS, and increase the ADB Connection time out (ms) value from 5000 to, say, 10000, then start the emulator again.
- Leave the emulator running, but you can close the Android Virtual Device Manager.
Where to go from here?
Now that you're all set up, try creating your own mobile app. Use IBM Mobile Quality Assurance to find and root out imperfections.