Android Programming Tutorials

(Romina) #1
How To Get Started

If you wish to develop using command-line build tools, you will need to


install Apache Ant. You may have this already from previous Java


development work, as it is fairly common in Java projects. However, you


will need Ant version 1.8.1, so double-check your current copy (e.g., ant


-version) to ensure you are on the proper edition.


If you do not have Ant, you can obtain it from the Apache Ant Web site.


They have full installation instructions in the Ant manual, but the basic


steps are:



  1. Unpack the ZIP archive wherever it may make sense on your


machine



  1. Add a JAVA_HOME environment variable, pointing to where your JDK


is installed, if you do not have one already



  1. Add an ANT_HOME environment variable, pointing to the directory
    where you unpacked Ant in the first step above

  2. Add $JAVA_HOME/bin and $ANT_HOME/bin to your PATH

  3. Run ant -version to confirm that Ant is installed properly


Set Up the Emulator.................................................................................


The Android tools include an emulator, a piece of software that pretends to


be an Android device. This is very useful for development – not only does it


mean you can get started on Android without a device, but the emulator


can help test device configurations that you do not own.


The Android emulator can emulate one or several Android devices. Each


configuration you want is stored in an "Android Virtual Device", or AVD.


The SDK and AVD Manager, which you used to download the SDK


components earlier in this chapter, is where you create these AVDs.


If you do not have the SDK and AVD Manager running, you can run it via


the android command from your SDK's tools/ directory, or via Window |


SDK and AVD Manager from Eclipse. It starts up on a screen listing the


AVDs you have available – initially, the list will be empty:


386
Free download pdf