[转]Setting up a Device for Development

Setting up a Device for Development

With an Android-powered device, 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 theAndroidManifest.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.
    • If you're developing on Windows, you need to install a USB driver for adb. Follow the steps below for Installing the WinUsb Driver.
    • If you're developing on Mac OS X, it just works. Skip this step.
    • 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/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"

      2. Now execute:
        chmod a+rx /etc/udev/rules.d/51-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.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值