| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | page.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> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 10 | <li><a href="#consumer">Consumer devices</a></li> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 11 | <li><a href="#dev-phone-1">Android Dev Phone 1</a></li> |
| 12 | </ol> |
| 13 | </li> |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 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> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | </ol> |
| 25 | </div> |
| 26 | </div> |
| 27 | |
| 28 | <p>When building mobile applications, it's vital to test them on real |
| 29 | devices prior to releasing them to users. This page covers what you need to know, |
| 30 | including the types of devices that you can use, and how to set one up for |
| 31 | developing and debugging.</p> |
| 32 | |
| 33 | |
| 34 | <h2 id="devices">Available Devices</h2> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 35 | <p>Here are some options for obtaining devices capable of testing your applications.</p> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | |
| 37 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 38 | <h3 id="consumer">Consumer devices</h3> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 40 | <p>It's likely that one of your local mobile carriers offers an Android-powered device. |
| 41 | Any Android-powered device (even one bought from your mobile carrier) is a perfectly good |
| 42 | device for running and testing your own Android applications. |
| 43 | You can write applications using the Android SDK and then install them |
| 44 | directly onto the device for testing.</p> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 46 | <p>Check with the service providers in your area to determine which Android-powered |
| 47 | devices are available.</p> |
| 48 | |
| 49 | <p>Be aware that consumer devices are not designed to allow system image updates by the |
| 50 | user. If you're interested in manually updating the device with custom system images, then |
| 51 | you'll need a developer device such as the <a href="#dev-phone-1">Android Dev Phone 1</a>.</p> |
| 52 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | |
| 54 | |
| 55 | <h3 id="dev-phone-1">Android Dev Phone 1</h3> |
| 56 | |
| 57 | <div class="sidebox-wrapper"> |
| Scott Main | f54574a | 2010-03-24 17:18:01 -0700 | [diff] [blame] | 58 | <div class="sidebox"> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 76 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | <p>The Android Dev Phone 1 is a SIM-unlocked and hardware-unlocked device that |
| 78 | is designed for advanced developers. The device ships with a system image that |
| 79 | is fully compatible with Android 1.0, so you can rely on it when developing your |
| 80 | applications. You can use any SIM in the device and can flash custom Android |
| 81 | builds that will work with the unlocked bootloader. Unlike the bootloader on |
| 82 | retail devices, the bootloader on the Android Dev Phone 1 does not enforce |
| 83 | signed system images. The Android Dev Phone 1 should also appeal to developers |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 84 | who live in geographies where local mobile carriers do not currently offer Android-powered devices. </p> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | |
| 86 | <p>To purchase an Android Dev Phone 1 device, you must first register as an |
| 87 | Android developer on the Android Market site, if you haven't done so already. |
| 88 | Once you've logged into your developer account on Android Market, you can |
| 89 | purchase the device by following the link to "Development phones." To accommodate demand, |
| 90 | there 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), |
| 93 | and is available for purchase in 18 international markets, including the |
| 94 | US, UK, Germany, Japan, India, Canada, France, Taiwan, Spain, Australia, |
| 95 | Singapore, Switzerland, Netherlands, Austria, Sweden, Finland, Poland, and |
| 96 | Hungary. We will continue to expand this program into new geographies over |
| 97 | time. Check this page for updated information.</p> |
| 98 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 99 | <p>Android Dev Phone 1 devices are <em>not</em> intended for |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | non-developer end-users. Because the device can be configured with system |
| 101 | software not provided by or supported by Google or any other company, end-users |
| 102 | operate these devices at their own risk.</p> |
| 103 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 104 | <p>Note that your Android Dev Phone 1 will not receive automated |
| 105 | over-the-air (OTA) updates for the system image. System updates must be flashed manually. |
| 106 | See the HTC site for a guide to <a href="http://www.htc.com/www/support/android/adp.html">Flashing |
| 107 | your Android Dev Phone with a Factory System Image</a>.</p> |
| 108 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 109 | <p>For full device specs and more information about obtaining an Android Dev |
| 110 | Phone 1 device, see the <a href="http://market.android.com/publish">Android |
| 111 | Market</a> site.</p> |
| 112 | |
| 113 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 114 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 115 | <h2 id="setting-up">Setting up a Device for Development</h2> |
| 116 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 117 | <p>With an Android-powered device, you can develop and debug your Android applications just as you |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 118 | would 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> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 128 | </li> |
| 129 | <li>Setup your system to detect your device. |
| 130 | <ul> |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 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> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | <li>If you're developing on Mac OS X, it just works. Skip this step.</li> |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 135 | <li>If you're developing on Ubuntu Linux, you need to add a rules file |
| 136 | that contains a USB configuration for each type of device you want to use for |
| 137 | development. Each device manufacturer uses a different vendor ID. The |
| 138 | example 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 |
| 140 | lines 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 |
| 142 | href="#VendorIds">USB Vendor IDs</a>, below. |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 143 | <ol> |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 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> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 149 | |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 150 | <p>For Dapper, edit the file to read:<br/> |
| 151 | <code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", |
| 152 | MODE="0666"</code></p> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | </li> |
| 154 | <li>Now execute:<br/> |
| Scott Main | 87b9055 | 2009-08-26 15:18:14 -0700 | [diff] [blame] | 155 | <code>chmod a+r /etc/udev/rules.d/51-android.rules</code> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 156 | </li> |
| 157 | </ol> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 |
| 163 | SDK 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 |
| 165 | with a <b>Device Chooser</b> dialog that lists the available emulator(s) and connected device(s). |
| 166 | Select 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), |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 169 | you can issue commands with the <code>-d</code> flag to target your |
| 170 | connected device.</p> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 171 | |
| 172 | |
| Scott Main | ad68fdd | 2009-11-05 18:53:59 -0800 | [diff] [blame] | 173 | <h3 id="VendorIds">USB Vendor IDs</h3> |
| 174 | <p>This table provides a reference to the vendor IDs needed in order to add |
| 175 | device 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> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame] | 195 | |