| 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> |
| 14 | <li><a href="#setting-up">Setting up a Device for Development</a></li> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 15 | <li><a href="#WinUsbDriver">Installing the WinUsb Driver</a></li> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 16 | </ol> |
| 17 | </div> |
| 18 | </div> |
| 19 | |
| 20 | <p>When building mobile applications, it's vital to test them on real |
| 21 | devices prior to releasing them to users. This page covers what you need to know, |
| 22 | including the types of devices that you can use, and how to set one up for |
| 23 | developing and debugging.</p> |
| 24 | |
| 25 | |
| 26 | <h2 id="devices">Available Devices</h2> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 27 | <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] | 28 | |
| 29 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 30 | <h3 id="consumer">Consumer devices</h3> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 32 | <p>It's likely that one of your local mobile carriers offers an Android-powered device. |
| 33 | Any Android-powered device (even one bought from your mobile carrier) is a perfectly good |
| 34 | device for running and testing your own Android applications. |
| 35 | You can write applications using the Android SDK and then install them |
| 36 | directly onto the device for testing.</p> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 38 | <p>Check with the service providers in your area to determine which Android-powered |
| 39 | devices are available.</p> |
| 40 | |
| 41 | <p>Be aware that consumer devices are not designed to allow system image updates by the |
| 42 | user. If you're interested in manually updating the device with custom system images, then |
| 43 | you'll need a developer device such as the <a href="#dev-phone-1">Android Dev Phone 1</a>.</p> |
| 44 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | |
| 46 | |
| 47 | <h3 id="dev-phone-1">Android Dev Phone 1</h3> |
| 48 | |
| 49 | <div class="sidebox-wrapper"> |
| 50 | <div class="sidebox-inner"> |
| 51 | <p>Selected specs for Android Dev Phone 1:</p> |
| 52 | <ul> |
| 53 | <li>Touch screen</li> |
| 54 | <li>Trackball</li> |
| 55 | <li>3.2 megapixel camera with autofocus</li> |
| 56 | <li>Wi-Fi</li> |
| 57 | <li>GPS-enabled</li> |
| 58 | <li>Bluetooth v2.0 |
| 59 | <ul><li>Handsfree profile v1.5</li> |
| 60 | <li>Headset profile v1.0</li></ul></li> |
| 61 | <li>3G WCDMA (1700/2100 MHz)</li> |
| 62 | <li>Quad-band GSM (850/900/1800/1900 MHz)</li> |
| 63 | <li>QWERTY slider keyboard</li> |
| 64 | <li>Includes 1GB MicroSD card (can be replaced with up to 16GB card)</li> |
| 65 | </ul> |
| 66 | </div> |
| 67 | </div> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 68 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | <p>The Android Dev Phone 1 is a SIM-unlocked and hardware-unlocked device that |
| 70 | is designed for advanced developers. The device ships with a system image that |
| 71 | is fully compatible with Android 1.0, so you can rely on it when developing your |
| 72 | applications. You can use any SIM in the device and can flash custom Android |
| 73 | builds that will work with the unlocked bootloader. Unlike the bootloader on |
| 74 | retail devices, the bootloader on the Android Dev Phone 1 does not enforce |
| 75 | 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^] | 76 | 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] | 77 | |
| 78 | <p>To purchase an Android Dev Phone 1 device, you must first register as an |
| 79 | Android developer on the Android Market site, if you haven't done so already. |
| 80 | Once you've logged into your developer account on Android Market, you can |
| 81 | purchase the device by following the link to "Development phones." To accommodate demand, |
| 82 | there is a limit of 1 device per developer account, for now.</p> |
| 83 | |
| 84 | <p>The device currently costs $399 (USD) (including free shipping in the US), |
| 85 | and is available for purchase in 18 international markets, including the |
| 86 | US, UK, Germany, Japan, India, Canada, France, Taiwan, Spain, Australia, |
| 87 | Singapore, Switzerland, Netherlands, Austria, Sweden, Finland, Poland, and |
| 88 | Hungary. We will continue to expand this program into new geographies over |
| 89 | time. Check this page for updated information.</p> |
| 90 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 91 | <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] | 92 | non-developer end-users. Because the device can be configured with system |
| 93 | software not provided by or supported by Google or any other company, end-users |
| 94 | operate these devices at their own risk.</p> |
| 95 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 96 | <p>Note that your Android Dev Phone 1 will not receive automated |
| 97 | over-the-air (OTA) updates for the system image. System updates must be flashed manually. |
| 98 | See the HTC site for a guide to <a href="http://www.htc.com/www/support/android/adp.html">Flashing |
| 99 | your Android Dev Phone with a Factory System Image</a>.</p> |
| 100 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | <p>For full device specs and more information about obtaining an Android Dev |
| 102 | Phone 1 device, see the <a href="http://market.android.com/publish">Android |
| 103 | Market</a> site.</p> |
| 104 | |
| 105 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 106 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 107 | <h2 id="setting-up">Setting up a Device for Development</h2> |
| 108 | |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 109 | <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] | 110 | would on the emulator. There are just a few things to do before you can start.</p> |
| 111 | <ol> |
| 112 | <li>Declare your application as "debuggable" in your Android Manifest. |
| 113 | <p>In Eclipse, you can do this from the <b>Application</b> tab when viewing the Manifest |
| 114 | (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] | 115 | file, add <code>android:debuggable="true"</code> to the <code><application></code> element.</p> |
| 116 | </li> |
| 117 | <li>Turn on "USB Debugging" on your device. |
| 118 | <p>On the device, go to the home screen, press <b>MENU</b>, select <b>Applications</b> > <b>Development</b>, |
| 119 | then enable <b>USB debugging</b>.</p> |
| 120 | |
| 121 | </li> |
| 122 | <li>Setup your system to detect your device. |
| 123 | <ul> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 124 | <li>If you're developing on Windows, you need to install a USB driver for adb. |
| 125 | Follow the steps below for <a href="#WinUsbDriver">Installing the WinUsb Driver</a>.</li> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 126 | <li>If you're developing on Mac OS X, it just works. Skip this step.</li> |
| 127 | <li>If you're developing on Ubuntu Linux, you need to add a rules file: |
| 128 | <ol> |
| Dirk Dougherty | fa03b80 | 2009-06-23 11:35:31 -0700 | [diff] [blame] | 129 | <li>Login as root and create this file: <code>/etc/udev/rules.d/51-android.rules</code>. |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 130 | <p>For Gusty/Hardy, edit the file to read: <br/> |
| 131 | <code>SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"</code></p> |
| 132 | |
| 133 | <p>For Dapper, edit the file to read: <br/> |
| 134 | <code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"</code></p> |
| 135 | </li> |
| 136 | <li>Now execute:<br/> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 137 | <code>chmod a+rx /etc/udev/rules.d/51-android.rules</code> |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 138 | </li> |
| 139 | </ol> |
| 140 | |
| 141 | </li> |
| 142 | </ul> |
| 143 | </li> |
| 144 | </ol> |
| 145 | <p>You can verify that your device is connected by executing <code>adb devices</code> from your |
| 146 | SDK tools/ directory. If connected, you'll see the device name listed as a "device."</p> |
| 147 | <p>If using Eclipse, select run or debug as usual. You will be presented |
| 148 | with a <b>Device Chooser</b> dialog that lists the available emulator(s) and connected device(s). |
| 149 | Select the device to install and run the application there.</p> |
| 150 | |
| 151 | <p>If using the <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a> (adb), |
| 152 | you can issue commands with the <code>-d</code> flag to target your connected device.</p> |
| Scott Main | 7991745 | 2009-08-26 11:56:57 -0700 | [diff] [blame^] | 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | <h2 id="WinUsbDriver">Installing the WinUsb Driver</h2> |
| 158 | |
| 159 | <p>A WinUsb-based driver is needed in order to use your Android-powered device for development on a Windows machine. |
| 160 | The USB installation package can be found in the <code><em><sdk></em>\usb_driver\</code> |
| 161 | folder of your SDK package.</p> |
| 162 | |
| 163 | <p class="note"><strong>Note:</strong> If you are connecting an Android-powered device to your computer |
| 164 | for the first time, folllow the procedure to "Perform a fresh installation." |
| 165 | Android SDKs older than version 1.6 included a non-WinUsb-based driver |
| 166 | for connecting your device. If you installed the older USB driver and it is working properly, |
| 167 | you do not need to upgrade to the new driver. However, if you are having problems with the driver or |
| 168 | would simply like to upgrade to the latest version, follow the procedure to "Upgrade an existing |
| 169 | driver." </p> |
| 170 | |
| 171 | <p>Before you begin installing or upgrading the USB driver, you must |
| 172 | copy the USB installation package to a secure location on your computer. |
| 173 | For example, you might want to create a directory at <code>C:\Android\Windows\USB\install\</code> and |
| 174 | move it there. Once you've moved the installation package, select the appropriate procedure below, |
| 175 | based on your operating system and whether you're installing for the first time or upgrading.</p> |
| 176 | |
| 177 | <ol class="nolist"> |
| 178 | <li>Windows Vista: |
| 179 | <ol class="nolist"> |
| 180 | <li><a href="#VistaFreshInstall">Perform a fresh installation</a></li> |
| 181 | <li><a href="#VistaUprade">Upgrade an existing driver</a></li> |
| 182 | </ol> |
| 183 | </li> |
| 184 | <li>Windows XP: |
| 185 | <ol class="nolist"> |
| 186 | <li><a href="#XPFreshInstall">Perform a fresh installation</a></li> |
| 187 | <li><a href="#XPUpgrade">Upgrade an existing driver</a></li> |
| 188 | </ol> |
| 189 | </li> |
| 190 | </ol> |
| 191 | |
| 192 | |
| 193 | <p class="caution"><strong>Caution:</strong> |
| 194 | You may make changes to <code>android_winusb.inf</code> file found inside <code>usb_driver\</code> |
| 195 | (e.g., to add support for new devices), |
| 196 | however, this will lead to security warnings when you install or upgrade the |
| 197 | driver. Making any other changes to the driver files may break the installation process.</p> |
| 198 | |
| 199 | <h3 id="VistaFreshInstall">Windows Vista: Perform a fresh installation</h3> |
| 200 | |
| 201 | <p>To install the Android USB driver on Windows Vista for the first time:</p> |
| 202 | |
| 203 | <ol> |
| 204 | <li>Connect your Android-powered device to your computer's USB port. Windows will detect the device |
| 205 | and launch the Found New Hardware wizard.</li> |
| 206 | <li>Select "Locate and install driver software."</li> |
| 207 | <li>Select "Don't search online."</li> |
| 208 | <li>Select "I don't have the disk. Show me other options."</li> |
| 209 | <li>Select "Browse my computer for driver software."</li> |
| 210 | <li>Click "Browse..." and locate the folder where you copied the |
| 211 | installation package. As long as you specified the exact location of the |
| 212 | installation package, you may leave "Include subfolders" checked or unchecked—it doesn't matter.</li> |
| 213 | <li>Click "Next." Vista may prompt you to confirm the privilege elevation required for driver |
| 214 | installation. Confirm it.</li> |
| 215 | <li>When Vista asks if you'd like to install the Google ADB Interface device, click "Install" |
| 216 | to install the driver.</li> |
| 217 | </ol> |
| 218 | |
| 219 | <p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p> |
| 220 | |
| 221 | |
| 222 | |
| 223 | <h3 id="VistaUpgrade">Windows Vista: Upgrade an existing driver</h3> |
| 224 | |
| 225 | <p>To upgrade an existing Android USB driver on Windows Vista with the new one:</p> |
| 226 | |
| 227 | <ol> |
| 228 | <li>Connect your Android-powered device to your computer's USB port.</li> |
| 229 | <li>Right-click on "Computer" from your desktop or Windows Explorer, |
| 230 | and select "Manage."</li> |
| 231 | <li>Select "Device Manager" in the left pane of the Computer Management window.</li> |
| 232 | <li>Locate and expand "ADB Interface" in the right pane.</li> |
| 233 | <li>Right-click on "HTC Dream Composite ADB Interface", and select "Update Driver Software..."</li> |
| 234 | <li>When Vista starts updating the driver, a prompt will ask how you want to search for the driver |
| 235 | software. Select "Browse my computer for driver software."</li> |
| 236 | <li>Click "Browse..." and locate the folder where you copied the |
| 237 | installation package. As long as you specified the exact location of the |
| 238 | installation package, you may leave "Include subfolders" checked or unchecked—it doesn't matter.</li> |
| 239 | <li>Click "Next." Vista may prompt you to confirm the privilege elevation required for driver |
| 240 | installation. Confirm it.</li> |
| 241 | <li>When Vista asks if you'd like to install the Google ADB Interface device, click "Install" |
| 242 | to install the driver.</li> |
| 243 | </ol> |
| 244 | |
| 245 | <p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p> |
| 246 | |
| 247 | |
| 248 | |
| 249 | <h3 id="XPFreshInstall">Windows XP: Perform a fresh installation</h3> |
| 250 | |
| 251 | <p>To install the Android USB driver on Windows XP for the first time:</p> |
| 252 | |
| 253 | <ol> |
| 254 | <li>Connect your Android-powered device to your computer's USB port. Windows |
| 255 | will detect the device and launch the Hardware Update Wizard.</li> |
| 256 | <li>Select "Install from a list or specific location" and click |
| 257 | "Next."</li> |
| 258 | <li>Select "Search for the best driver in these locations"; uncheck "Search |
| 259 | removable media"; and check "Include this location in the search."</li> |
| 260 | <li>Click "Browse..." and locate the folder where you copied the installation |
| 261 | package.</li> |
| 262 | <li>Click "Next" to install the driver.</li> |
| 263 | </ol> |
| 264 | |
| 265 | <p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p> |
| 266 | |
| 267 | |
| 268 | |
| 269 | <h3 id="XPUpgrade">Windows XP: Upgrade an existing driver</h3> |
| 270 | |
| 271 | <p>To upgrade an existing Android USB driver on Windows XP with the new one:</p> |
| 272 | |
| 273 | <ol> |
| 274 | <li>Connect your Android-powered device to your computer's USB port.</li> |
| 275 | <li>Right-click on "My Computer" from your desktop or Windows Explorer, |
| 276 | and select "Manage."</li> |
| 277 | <li>Select "Device Manager" in the left pane of the Computer Management window.</li> |
| 278 | <li>Locate and expand "Android Phone" in the right pane.</li> |
| 279 | <li>Right-click "Android Composite ADB Interface" and select "Update Driver..." |
| 280 | This will launch the Hardware Update Wizard.</li> |
| 281 | <li>Select "Install from a list or specific location" and click |
| 282 | "Next."</li> |
| 283 | <li>Select "Search for the best driver in these locations"; uncheck "Search |
| 284 | removable media"; and check "Include this location in the search."</li> |
| 285 | <li>Click "Browse..." and locate the folder where you copied the installation |
| 286 | package.</li> |
| 287 | <li>Click "Next" to install the driver.</li> |
| 288 | </ol> |
| 289 | |
| 290 | <p>Return to <a href="#setting-up">Setting up a Device for Development</a>.</p> |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |