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.
Available Devices
While developers can use regular
consumer devices purchased at retail to test and use their apps, some developers
may choose not to use a retail device, preferring an unlocked or no-contract
device. Here are some options for obtaining devices capable of testing your applications.
T-Mobile G1
The T-Mobile G1 device makes an excellent development device. You can write
applications in the SDK and install them on the G1, then run them as users
would, using the same hardware, system, and network.
For more information about obtaining a G1, visit the T-Mobile G1 site.
Android Dev Phone 1
Selected specs for Android Dev Phone 1:
- Touch screen
- Trackball
- 3.2 megapixel camera with autofocus
- Wi-Fi
- GPS-enabled
- Bluetooth v2.0
- Handsfree profile v1.5
- Headset profile v1.0
- 3G WCDMA (1700/2100 MHz)
- Quad-band GSM (850/900/1800/1900 MHz)
- QWERTY slider keyboard
- Includes 1GB MicroSD card (can be replaced with up to 16GB card)
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 outside of T-Mobile geographies.
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.
Note that 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.
For full device specs and more information about obtaining an Android Dev
Phone 1 device, see the Android
Market site.
Setting up a Device for Development
With a T-mobile G1 or Android Dev Phone 1, 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.
- Declare your application as "debuggable" in your Android Manifest.
In Eclipse, you can do this from the Application tab when viewing the Manifest
(on the right side, set Debuggable to true). Otherwise, in the AndroidManifest.xml
file, add android:debuggable="true"
to the <application>
element.
- Turn on "USB Debugging" on your device.
On the device, go to the home screen, press MENU, select Applications > Development,
then enable USB debugging.
- Setup your system to detect your device.
- If you're developing on 32-bit Windows, you need to install the 32-bit USB driver for adb.
The USB driver is included in the SDK package. To install it, follow these steps:
- Connect your Android device via USB. When the Found New Hardware Wizard appears,
you'll be asked if you'd like Windows Update to search for software. Select No, not this
time and click Next.
- Select Install from a list or specified location and click Next.
- Select Search for the best driver in these locations. Browse to the
usb_driver/x86
in the SDK package (<sdk>\usb_driver\x86
).
- Click Finish. The system should install the driver files as necessary. Your machine may require a reboot.
- If you're developing on 64-bit Windows Vista, you need to install the 64-bit USB driver for adb.
The USB driver is included in the SDK package. To install it, follow these steps:
- Connect your Android device via USB. When the Found New Hardware Wizard appears,
you'll be asked if you'd like Windows Update to search for software. Select No, not this
time and click Next.
- Select Install from a list or specified location and click Next.
- Select Search for the best driver in these locations. Browse to the
usb_driver/amd64
in the SDK package (<sdk>\usb_driver\amd64
).
- Click Finish. The system should install the driver files as necessary. Your machine may require a reboot.
- If you're developing on Mac OS X, it just works. Skip this step.
- If you're developing on Ubuntu Linux, you need to add a rules file:
- Login as root and create this file:
/etc/udev/rules.d/51-android.rules
.
For Gusty/Hardy, edit the file to read:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
For Dapper, edit the file to read:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
- Now execute:
chmod a+rx /etc/udev/rules.d/50-android.rules
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 issue commands with the -d
flag to target your connected device.