Java Programming for Android: Install Software Tools to Get Started
Before you can write Java programs for Android devices, you need some software tools. If you’re an old hand at installing software, and if your computer isn’t quirky, these steps will probably serve you well.
Visit the Java Programming for Android Developers for Dummies webpage and download a file containing program examples.
Visit the Java website and download the Java Runtime Environment (if you don’t already have a recent version of Java on your computer).
Choose a version of the software that matches your operating system (Windows, Macintosh, or whatever) and your operating system’s word length (32-bit or 64-bit).
Visit the Android SDK webpage and download the Android Software Development Kit (SDK).
The downloaded bundle is a .zip archive file.
Extract the contents of the downloaded archive file to your local hard drive.
The figure shows the file downloaded on a Windows computer. The .zip file’s contents were extracted to a new folder, named c:UsersMyUserNameadt-bundle-windows-x86.
This figure shows the file downloaded on a Mac computer. The .zip file’s contents were extracted into an existing Applications folder.
If the Android SDK .zip file contains more than one folder, don’t separate the folders when you extract the .zip file’s contents. Extract all content inside the .zip file to the same place on your hard drive.
Launch the Eclipse app.
The first time you run a fresh, new copy of Eclipse, the Welcome screen appears.
Dismiss the Welcome screen.
For most versions of Eclipse, you can dismiss the Welcome screen by clicking the little x icon that appears on a tab above the screen.
Import the code that you downloaded in Step 1.
In Eclipse, choose File→Import→Existing Projects into Workspace. Then browse for the sample code you downloaded — the .zip file from Step 1. (If the web browser automatically expanded the .zip archive, browse for the folder containing the files that were in the archive.)
Create an Android virtual device.
You can test Android programs on a phone or a tablet. But, for convenience, you might test on an emulator — a program that behaves like a phone or a tablet but runs on the development computer.
To run an emulator, you need an Android Virtual Device (AVD), which is a set of specs for a device (processor type, screen size, screen resolution, and Android version, for example). In Eclipse, you create an AVD by choosing Window→Android Virtual Device Manager and filling in the blanks.