From 01979991dc554fa64515028b6f01c1ab7be466b7 Mon Sep 17 00:00:00 2001 From: Scott Main Date: Mon, 5 Apr 2010 17:42:17 -0700 Subject: [PATCH] docs: update information about developing on a device. Remove details about ADP1 and revise intro. Add links to the device doc from installing guides. Revise the procedures for Running Your Application in both the Eclipse and Other IDE guides to specifically describe using a device and make both docs more consistent with each other. Change-Id: Ica77533e78141db43eb3ed214309f571beff7353 --- docs/html/guide/developing/device.jd | 186 ++++++++----------- docs/html/guide/developing/eclipse-adt.jd | 149 +++++++++------ docs/html/guide/developing/other-ide.jd | 213 ++++++++++++++-------- docs/html/sdk/installing.jd | 10 +- 4 files changed, 314 insertions(+), 244 deletions(-) diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd index 22c099fa7460f..2e2d80381fd5a 100644 --- a/docs/html/guide/developing/device.jd +++ b/docs/html/guide/developing/device.jd @@ -5,12 +5,6 @@ page.title=Developing on a Device

In this document

    -
  1. Available Devices -
      -
    1. Consumer devices
    2. -
    3. Android Dev Phone 1
    4. -
    -
  2. Setting up a Device for Development
    1. USB Vendor IDs
    2. @@ -21,101 +15,50 @@ page.title=Developing on a Device
      1. USB Driver for Windows
      2. +
      3. Developing in Eclipse, with ADT
      4. +
      5. Developing in other IDEs
-

When building mobile applications, it's vital to test them on real -devices prior to releasing them to users. This page covers what you need to know, -including the types of devices that you can use, and how to set one up for -developing and debugging.

+

When building a mobile application, it's important that you always test your application on a +real device before releasing it to users. This page describes how to set up your development +environment and Android-powered device for testing and debugging on the device.

+

You can use any Android-powered device as an environment for running, +debugging, and testing your applications. The tools included in the SDK make it easy to install and +run your application on the device each time you compile. You can install your application on the +device directly from +Eclipse or from the +command line. If +you don't yet have a device, check with the service providers in your area to determine which +Android-powered devices are available.

-

Available Devices

-

Here are some options for obtaining devices capable of testing your applications.

- - -

Consumer devices

- -

It's likely that one of your local mobile carriers offers an Android-powered device. -Any Android-powered device (even one bought from your mobile carrier) is a perfectly good -device for running and testing your own Android applications. -You can write applications using the Android SDK and then install them -directly onto the device for testing.

- -

Check with the service providers in your area to determine which Android-powered -devices are available.

- -

Be aware that consumer devices are not designed to allow system image updates by the -user. If you're interested in manually updating the device with custom system images, then -you'll need a developer device such as the Android Dev Phone 1.

- - - -

Android Dev Phone 1

- - - -

The Android Dev Phone 1 is a SIM-unlocked and hardware-unlocked device that -is designed for advanced developers. The device ships with a system image that -is fully compatible with Android 1.0, so you can rely on it when developing your -applications. You can use any SIM in the device and can flash custom Android -builds that will work with the unlocked bootloader. Unlike the bootloader on -retail devices, the bootloader on the Android Dev Phone 1 does not enforce -signed system images. The Android Dev Phone 1 should also appeal to developers -who live in geographies where local mobile carriers do not currently offer Android-powered devices.

- -

To purchase an Android Dev Phone 1 device, you must first register as an -Android developer on the Android Market site, if you haven't done so already. -Once you've logged into your developer account on Android Market, you can -purchase the device by following the link to "Development phones." To accommodate demand, -there is a limit of 1 device per developer account, for now.

- -

The device currently costs $399 (USD) (including free shipping in the US), -and is available for purchase in 18 international markets, including the -US, UK, Germany, Japan, India, Canada, France, Taiwan, Spain, Australia, -Singapore, Switzerland, Netherlands, Austria, Sweden, Finland, Poland, and -Hungary. We will continue to expand this program into new geographies over -time. Check this page for updated information.

- -

Android Dev Phone 1 devices are not intended for -non-developer end-users. Because the device can be configured with system -software not provided by or supported by Google or any other company, end-users -operate these devices at their own risk.

- -

Note that your Android Dev Phone 1 will not receive automated -over-the-air (OTA) updates for the system image. System updates must be flashed manually. -See the HTC site for a guide to Flashing -your Android Dev Phone with a Factory System Image.

- -

For full device specs and more information about obtaining an Android Dev -Phone 1 device, see the Android -Market site.

+

If you want a SIM-unlocked phone, then you might consider either an Android Dev Phone or the +Google Nexus One. Both are SIM-unlocked so that you can use them on any GSM network using a SIM +card. The Android Dev Phones also feature an unlocked bootloader so you can install custom system +images (great for developing and installing custom versions of the Android platform). To purchase a +Nexus One, visit google.com/phone. To purchase an Android +Dev Phone, see the Android Market site +(requires a developer account).

+

Note: When developing on a device, keep in mind that you should +still use the Android emulator to test your application +on configurations that are not equivalent to those of your real device. Although the emulator +does not allow you to test every device feature (such as the accelerometer), it does +allow you to verify that your application functions properly on different versions of the Android +platform, in different screen sizes and orientations, and more.

Setting up a Device for Development

With an Android-powered device, you can develop and debug your Android applications just as you -would on the emulator. There are just a few things to do before you can start.

+would on the emulator. Before you can start, there are just a few things to do:

+
  1. Declare your application as "debuggable" in your Android Manifest.

    In Eclipse, you can do this from the Application tab when viewing the Manifest @@ -159,37 +102,70 @@ href="#VendorIds">USB Vendor IDs, below.

-

You can verify that your device is connected by executing adb devices from your -SDK tools/ directory. If connected, you'll see the device name listed as a "device."

-

If using Eclipse, select run or debug as usual. You will be presented -with a Device Chooser dialog that lists the available emulator(s) and connected device(s). -Select the device to install and run the application there.

-

If using the Android Debug Bridge (adb), +

You can verify that your device is connected by executing adb devices from your +SDK {@code tools/} directory. If connected, you'll see the device name listed as a "device."

+ +

If using Eclipse, run or debug as usual. You will be presented +with a Device Chooser dialog that lists the available emulator(s) and connected device(s). +Select the device upon which you want to install and run the application.

+ +

If using the Android Debug Bridge (adb), you can issue commands with the -d flag to target your connected device.

USB Vendor IDs

This table provides a reference to the vendor IDs needed in order to add -device support on Linux. The USB Vendor ID is the value given to the -SYSFS{idVendor} property in the rules file.

+USB device support on Linux. The USB Vendor ID is the value given to the +SYSFS{idVendor} property in the rules file, as described in step 3, above.

+ - + + - + + - + + - + + - + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + +
ManufacturerUSB Vendor ID
Acer0502
Acer0502
HTC0bb4
Dell413c
Huawei12d1
Foxconn0489
LG1004
Garmin-Asus091E
Motorola22b8
HTC0bb4
Samsung04e8
Huawei12d1
Sony Ericsson0fce
Kyocera0482
LG1004
Motorola22b8
Nvidia0955
Pantech10A9
Samsung04e8
Sharp04dd
Sony Ericsson0fce
ZTE19D2
- diff --git a/docs/html/guide/developing/eclipse-adt.jd b/docs/html/guide/developing/eclipse-adt.jd index c01745e67a2f2..549e093f2298f 100644 --- a/docs/html/guide/developing/eclipse-adt.jd +++ b/docs/html/guide/developing/eclipse-adt.jd @@ -6,10 +6,11 @@ page.title=Developing In Eclipse, with ADT

In this document

  1. Creating an Android Project
  2. +
  3. Creating an AVD
  4. Running Your Application
      -
    1. Creating an AVD
    2. -
    3. Running an application
    4. +
    5. Running on the emulator
    6. +
    7. Running on a device
  5. Creating a Custom Run Configuration
  6. @@ -27,7 +28,8 @@ applications:

    @@ -133,87 +136,117 @@ folders and files in your new project:

    -

    Running Your Application

    +

    Creating an AVD

    -

    Before you can run your application on the Android Emulator, -you must create an Android Virtual Device (AVD). -An AVD is a configuration that specifies the Android platform to be used on the emulator. -You can read more in the Android Virtual -Devices document, but if you just want to get started, follow the simple guide below to -create an AVD.

    +

    An Android Virtual Device (AVD) is a device configuration for the emulator that +allows you to model real world devices. In order to run an instance of the emulator, you must create +an AVD.

    -

    If you will be running your applications only on actual device hardware, you do not -need an AVD — see -Developing On a Device for information -on running your application.

    - -

    Creating an AVD

    - -

    With ADT 0.9.3 and above, the Android SDK and AVD Manager provides a simple graphical interface -for creating and managing AVDs. (If you're using ADT version 0.9.1 or older, you must -use the android tool to create your AVDs—read the AVD guide to -Creating an AVD.) - -

    To create an AVD with the AVD Manager:

    +

    To create an AVD from Eclipse:

      -
    1. Select Window > Android SDK and AVD Manager, or click the Android SDK and AVD Manager icon (a black device) - in the Eclipse toolbar.

      +
    2. Select Window > Android SDK and AVD Manager, or click the Android SDK and +AVD Manager icon in the Eclipse toolbar.

    3. -
    4. In the Virtual Devices panel, you'll see a list of existing AVDs. Click New - to create a new AVD.
    5. -
    6. Fill in the details for the AVD. -

      Give it a name, a platform target, an SD card image (optional), and +

    7. In the Virtual Devices panel, you'll see a list of existing AVDs. Click +New to create a new AVD.
    8. +
    9. Fill in the details for the AVD. +

      Give it a name, a platform target, an SD card size, and a skin (HVGA is default).

      +

      Note: Be sure to define + a target for your AVD that satisfies your application's Build Target (the AVD + platform target must have an API Level equal to or greater than the API Level that your +application compiles against).

    10. Click Create AVD.
    -

    Your AVD is now ready and you can close the AVD Manager. -In the next section, you'll see how the AVD is used -when launching your application on an emulator.

    +

    Your AVD is now ready and you can either close the SDK and AVD Manager, create more AVDs, or +launch an emulator with the AVD by selecting a device and clicking Start.

    -

    For more information about AVDs, read the +

    For more information about AVDs, read the Android Virtual Devices documentation.

    -

    Running your application

    +

    Running Your Application

    -

    Note: Before you can run your application, be sure that -you have created an AVD with a target that satisfies your application's Build Target. -If an AVD cannot be found that meets the requirements of your Build Target, you will see -a console error telling you so and the launch will be aborted.

    + -

    To run (or debug) your application, select Run > Run (or -Run > Debug) from the Eclipse main menu. The ADT plugin -will automatically create a default launch configuration for the project.

    +

    Running your application from Eclipse will usually require just a couple clicks, whether you're +running it on the emulator or on an attached device. The information below describes how to get +set up and run your application from Eclipse.

    -

    When you choose to run or debug your application, Eclipse will perform the following:

    +

    Running on the emulator

    + +

    Before you can run your application on the Android Emulator, +you must create an AVD.

    + +

    To run (or debug) your application, select Run > Run (or +Run > Debug) from the Eclipse menu bar. The ADT plugin +will automatically create a default launch configuration for the project. Eclipse will then perform +the following:

    1. Compile the project (if there have been changes since the last build).
    2. -
    3. Create a default launch configuration (if one does not already exist for the project).
    4. -
    5. Install and start the application on an emulator or device (based on the Deployment Target - defined by the run configuration). -

      By default, Android application run configurations use an "automatic target" mode for - selecting a device target. For information on how automatic target mode selects a - deployment target, see Automatic and manual +

    6. Create a default launch configuration (if one does not already exist for the +project).
    7. +
    8. Install and start the application on an emulator (or device), based on the Deployment +Target + defined by the run configuration. +

      By default, Android run configurations use an "automatic target" mode for + selecting a device target. For information on how automatic target mode selects a + deployment target, see Automatic and manual target modes below.

    -

    If debugging, the application will start in the "Waiting For Debugger" mode. Once the +

    If debugging, the application will start in the "Waiting For Debugger" mode. Once the debugger is attached, Eclipse will open the Debug perspective.

    -

    To set or change the launch configuration used for your project, use the launch configuration manager. +

    To set or change the launch configuration used for your project, use the launch configuration +manager. See Creating a Launch Configuration for information.

    +

    Be certain to create multiple AVDs upon which to test your application. You should have one AVD +for each platform and screen type with which your application is compatible. For +instance, if your application compiles against the Android 1.5 (API Level 3) platform, you should +create an AVD for each platform equal to and greater than 1.5 and an AVD for each screen type you support, then test +your application on each one.

    + + +

    Running on a device

    + +

    Before you can run your application on a device, you must perform some basic setup for your +device:

    + + +

    Read Setting up a Device for +Development for more information.

    + +

    Once set up and your device is connected via USB, install your application on the device by +selecting Run > Run (or +Run > Debug) from the Eclipse menu bar.

    + +

    Creating a Run Configuration

    The run configuration specifies the project to run, the Activity -to start, the emulator options to use, and so on. When you first run a project +to start, the emulator or connected device to use, and so on. When you first run a project as an Android Application, ADT will automatically create a run configuration. The default run configuration will launch the default project Activity and use automatic target mode for device selection @@ -240,7 +273,8 @@ for your Eclipse version:

    @@ -127,13 +138,16 @@ android create project \
  7. build.xml - Build file for Ant.
  8. default.properties - Properties for the build system. Do not modify this file.
  9. -
  10. build.properties - Customizable properties for the build system. You can edit this - file to override default build settings used by Ant and provide a pointer to your keystore and key alias +
  11. build.properties - Customizable properties for the build system. You can edit +this + file to override default build settings used by Ant and provide a pointer to your keystore and key +alias so that the build tools can sign your application when built in release mode.
  12. src/your/package/namespace/ActivityName.java - The Activity class you specified during project creation.
  13. bin/ - Output directory for the build script.
  14. -
  15. gen/ - Holds Ant-generated files, such as R.java.
  16. +
  17. gen/ - Holds Ant-generated files, such as R.java. +
  18. libs/ - Holds private libraries.
  19. res/ - Holds project resources.
  20. src/ - Holds source code.
  21. @@ -167,13 +181,15 @@ as needed for the Android project.

    To update an existing Android project, open a command-line and navigate to the tools/ directory of your SDK. Now run:

    -android update project --name <project_name> --target <target_ID> --path path/to/your/project/
    +android update project --name <project_name> --target <target_ID>
    +--path <path_to_your_project>