Preparing Android Development Environment

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา

To prepare your machine for developing a native Android application, you will need Eclipse IDE with the ADT (Android Developer Tools) plugin, and Android SDK tools. The most convenient way is to install the ADT bundle, which includes a version of the Eclipse IDE with built-in ADT.

Downloading and Installing JDK

Eclipse requires Java Development Kit (JDK) and Java Runtime Environment (JRE) to operate. Follow these steps to download and install the latest version of JDK, which also includes a version of JRE.

Downloading and Installing ADT bundle

  • Download the ADT bundle from http://developer.android.com/sdk/index.html
  • Extract the ZIP file adt-bundle-<os_platform>.zip into an appropriate location, such as C:\android
  • Open the adt-bundle-<os_platform>/eclipse/ directory and launch eclipse

Creating Your First Application

Test your ADT bundle installation by creating a simple application using the steps in http://developer.android.com/training/basics/firstapp/creating-project.html.

Running Your Application

You have two choices to test your application: on an actual device and on an emulator.

Running Application on a Real Device

  • On Windows, make sure the USB driver for your device has already been installed. See http://developer.android.com/tools/extras/oem-usb.html for more details and download links.
  • Plug your mobile device to your machine.
  • On Eclipse, choose Run as -> Android Application. Then choose the device from the device list panel. Eclipse will install your application on your device and start it.

Running Application on an Emulator

  • First, create an Android Virtual Device (AVD) by clicking the menu Window -> Android Virtual Device Manager.
  • In the Android Virtual Device Manager panel, click New.
  • Fill in the details for the new AVD. For example,
    • Name: My Tab Emulator
    • Device: 10.1" WXGA (Tablet) (1280 x 800: mdpi)
    • Target: Android 4.4.2 - API Level 19
    • CPU/ABI: ARM (armeabi-v7a)
    • Skin: HVGA
    • SD Card Size: 64 MiB
    • Emulation Options: Snapshot
These details can be changed later on.
  • Click OK to create your AVD.
  • Back to the Android Virtual Device Manager panel, select the newly created AVD and click Start.
  • On Eclipse, choose Run as -> Android Application, then select the desired AVD that appears on the device list panel.