1page.title=Developing on a Device 2@jd:body 3 4<div id="qv-wrapper"> 5<div id="qv"> 6 <h2>In this document</h2> 7 <ol> 8 <li><a href="#devices">Available Devices</a> 9 <ol> 10 <li><a href="#consumer">Consumer devices</a></li> 11 <li><a href="#dev-phone-1">Android Dev Phone 1</a></li> 12 </ol> 13 </li> 14 <li><a href="#setting-up">Setting up a Device for Development</a> 15 <ol> 16 <li><a href="#VendorIds">USB Vendor IDs</a></li> 17 </ol> 18 </li> 19 </ol> 20 <h2>See also</h2> 21 <ol> 22 <li><a 23 href="{@docRoot}sdk/win-usb.html">USB Driver for Windows</a></li> 24 </ol> 25</div> 26</div> 27 28<p>When building mobile applications, it's vital to test them on real 29devices prior to releasing them to users. This page covers what you need to know, 30including the types of devices that you can use, and how to set one up for 31developing and debugging.</p> 32 33 34<h2 id="devices">Available Devices</h2> 35<p>Here are some options for obtaining devices capable of testing your applications.</p> 36 37 38<h3 id="consumer">Consumer devices</h3> 39 40<p>It's likely that one of your local mobile carriers offers an Android-powered device. 41Any Android-powered device (even one bought from your mobile carrier) is a perfectly good 42device for running and testing your own Android applications. 43You can write applications using the Android SDK and then install them 44directly onto the device for testing.</p> 45 46<p>Check with the service providers in your area to determine which Android-powered 47devices are available.</p> 48 49<p>Be aware that consumer devices are not designed to allow system image updates by the 50user. If you're interested in manually updating the device with custom system images, then 51you'll need a developer device such as the <a href="#dev-phone-1">Android Dev Phone 1</a>.</p> 52 53 54 55<h3 id="dev-phone-1">Android Dev Phone 1</h3> 56 57<div class="sidebox-wrapper"> 58<div class="sidebox-inner"> 59<p>Selected specs for Android Dev Phone 1:</p> 60<ul> 61<li>Touch screen</li> 62<li>Trackball</li> 63<li>3.2 megapixel camera with autofocus</li> 64<li>Wi-Fi</li> 65<li>GPS-enabled</li> 66<li>Bluetooth v2.0 67 <ul><li>Handsfree profile v1.5</li> 68 <li>Headset profile v1.0</li></ul></li> 69<li>3G WCDMA (1700/2100 MHz)</li> 70<li>Quad-band GSM (850/900/1800/1900 MHz)</li> 71<li>QWERTY slider keyboard</li> 72<li>Includes 1GB MicroSD card (can be replaced with up to 16GB card)</li> 73</ul> 74</div> 75</div> 76 77<p>The Android Dev Phone 1 is a SIM-unlocked and hardware-unlocked device that 78is designed for advanced developers. The device ships with a system image that 79is fully compatible with Android 1.0, so you can rely on it when developing your 80applications. You can use any SIM in the device and can flash custom Android 81builds that will work with the unlocked bootloader. Unlike the bootloader on 82retail devices, the bootloader on the Android Dev Phone 1 does not enforce 83signed system images. The Android Dev Phone 1 should also appeal to developers 84who live in geographies where local mobile carriers do not currently offer Android-powered devices. </p> 85 86<p>To purchase an Android Dev Phone 1 device, you must first register as an 87Android developer on the Android Market site, if you haven't done so already. 88Once you've logged into your developer account on Android Market, you can 89purchase the device by following the link to "Development phones." To accommodate demand, 90there is a limit of 1 device per developer account, for now.</p> 91 92<p>The device currently costs $399 (USD) (including free shipping in the US), 93and is available for purchase in 18 international markets, including the 94US, UK, Germany, Japan, India, Canada, France, Taiwan, Spain, Australia, 95Singapore, Switzerland, Netherlands, Austria, Sweden, Finland, Poland, and 96Hungary. We will continue to expand this program into new geographies over 97time. Check this page for updated information.</p> 98 99<p>Android Dev Phone 1 devices are <em>not</em> intended for 100non-developer end-users. Because the device can be configured with system 101software not provided by or supported by Google or any other company, end-users 102operate these devices at their own risk.</p> 103 104<p>Note that your Android Dev Phone 1 will not receive automated 105over-the-air (OTA) updates for the system image. System updates must be flashed manually. 106See the HTC site for a guide to <a href="http://www.htc.com/www/support/android/adp.html">Flashing 107your Android Dev Phone with a Factory System Image</a>.</p> 108 109<p>For full device specs and more information about obtaining an Android Dev 110Phone 1 device, see the <a href="http://market.android.com/publish">Android 111Market</a> site.</p> 112 113 114 115<h2 id="setting-up">Setting up a Device for Development</h2> 116 117<p>With an Android-powered device, you can develop and debug your Android applications just as you 118would on the emulator. There are just a few things to do before you can start.</p> 119<ol> 120 <li>Declare your application as "debuggable" in your Android Manifest. 121 <p>In Eclipse, you can do this from the <b>Application</b> tab when viewing the Manifest 122 (on the right side, set <b>Debuggable</b> to <em>true</em>). Otherwise, in the <code>AndroidManifest.xml</code> 123 file, add <code>android:debuggable="true"</code> to the <code><application></code> element.</p> 124 </li> 125 <li>Turn on "USB Debugging" on your device. 126 <p>On the device, go to the home screen, press <b>MENU</b>, select <b>Applications</b> > <b>Development</b>, 127 then enable <b>USB debugging</b>.</p> 128 </li> 129 <li>Setup your system to detect your device. 130 <ul> 131 <li>If you're developing on Windows, you need to install a USB driver 132 for adb. See the <a href="{@docRoot}sdk/win-usb.html">Windows USB 133 Driver</a> documentation.</li> 134 <li>If you're developing on Mac OS X, it just works. Skip this step.</li> 135 <li>If you're developing on Ubuntu Linux, you need to add a rules file 136that contains a USB configuration for each type of device you want to use for 137development. Each device manufacturer uses a different vendor ID. The 138example rules files below show how to add an entry for a single vendor ID 139(the HTC vendor ID). In order to support more devices, you will need additional 140lines of the same format that provide a different value for the 141<code>SYSFS{idVendor}</code> property. For other IDs, see the table of <a 142href="#VendorIds">USB Vendor IDs</a>, below. 143 <ol> 144 <li>Log in as root and create this file: 145 <code>/etc/udev/rules.d/51-android.rules</code>. 146 <p>For Gusty/Hardy, edit the file to read:<br/> 147 <code>SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", 148 MODE="0666"</code></p> 149 150 <p>For Dapper, edit the file to read:<br/> 151 <code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", 152 MODE="0666"</code></p> 153 </li> 154 <li>Now execute:<br/> 155 <code>chmod a+r /etc/udev/rules.d/51-android.rules</code> 156 </li> 157 </ol> 158 </li> 159 </ul> 160 </li> 161</ol> 162<p>You can verify that your device is connected by executing <code>adb devices</code> from your 163SDK tools/ directory. If connected, you'll see the device name listed as a "device."</p> 164<p>If using Eclipse, select run or debug as usual. You will be presented 165with a <b>Device Chooser</b> dialog that lists the available emulator(s) and connected device(s). 166Select the device to install and run the application there.</p> 167 168<p>If using the <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a> (adb), 169you can issue commands with the <code>-d</code> flag to target your 170connected device.</p> 171 172 173<h3 id="VendorIds">USB Vendor IDs</h3> 174<p>This table provides a reference to the vendor IDs needed in order to add 175device support on Linux. The USB Vendor ID is the value given to the 176<code>SYSFS{idVendor}</code> property in the rules file.</p> 177<table> 178 <tr> 179 <th>Manufacturer</th><th>USB Vendor ID</th></tr> 180 <tr> 181 <td>Acer</td><td>0502</td></tr> 182 <tr> 183 <td>HTC</td><td>0bb4</td></tr> 184 <tr> 185 <td>Huawei</td><td>12d1</td></tr> 186 <tr> 187 <td>LG</td><td>1004</td></tr> 188 <tr> 189 <td>Motorola</td><td>22b8</td></tr> 190 <tr> 191 <td>Samsung</td><td>04e8</td></tr> 192 <tr> 193 <td>Sony Ericsson</td><td>0fce</td></tr> 194</table> 195 196