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.

1. 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.

2. Turn on "USB Debugging" on your device.

On the device, go to the home screen, press MENU, select Applications > Development, then enable USB debugging.

3. Setup your system to detect your device.

o 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:

1. 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.

2. Select Install from a list or specified location and click Next.

3. Select Search for the best driver in these locations. Browse to the usb_driver/x86 in the SDK package (<sdk>\usb_driver\x86).

4. Click Finish. The system should install the driver files as necessary. Your machine may require a reboot.

o 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:

1. 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.

2. Select Install from a list or specified location and click Next.

3. Select Search for the best driver in these locations. Browse to the usb_driver/amd64 in the SDK package (<sdk>\usb_driver\amd6 4).

4. Click Finish. The system should install the driver files as necessary. Your machine may require a reboot.

o If you're developing on Mac OS X, it just works. Skip this step. o If you're developing on Ubuntu Linux, you need to add a rules file:

1. Login as root and create this file: /etc/udev/rules.d/50-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"

2. 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.

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License. ! Go to top

Site Terms of Service - Privacy Policy - Brand Guidelines

0 0

Post a comment