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 with ADB. If you don't yet have a device, check with the service providers in your area to determine which Android-powered devices are available.
If you want a SIM-unlocked phone, then you might consider either an Android Dev Phone or the Google Nexus S. These 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 find a a place you can purchase the Nexus S, 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.
With an Android-powered device, you can develop and debug your Android applications just as you would on the emulator. Before you can start, there are just a few things to do:
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.
On the device, go to the home screen, press MENU, select Applications > Development, then enable USB debugging.
SYSFS{idVendor}
property. For other IDs, see the table of USB Vendor IDs, below.
/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"
chmod a+r /etc/udev/rules.d/51-android.rules
You can verify that your device is connected by executing adb devices
from your
SDK platform-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.
This table provides a reference to the vendor IDs needed in order to add
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.
Manufacturer | USB Vendor ID |
---|---|
Acer | 0502 |
Dell | 413c |
Foxconn | 0489 |
Garmin-Asus | 091E |
HTC | 0bb4 |
Huawei | 12d1 |
Kyocera | 0482 |
LG | 1004 |
Motorola | 22b8 |
Nvidia | 0955 |
Pantech | 10A9 |
Samsung | 04e8 |
Sharp | 04dd |
Sony Ericsson | 0fce |
ZTE | 19D2 |