Debugging an Android app to the phone

泄露秘密 提交于 2019-12-12 07:48:38

问题


I've gone through the page Using Hardware Devices. My manifest has

<application android:icon="@drawable/icon" 
    android:label="@string/app_name"
    android:debuggable="true">

My phone has Menu -> Settings -> Applications -> Development -> USB Debugging checked.

I have gone to the control panel on my Windows XP 64 bit installation and installed the USB drivers given to me by the SDK installer in android-sdk_r05-windows\android-sdk-windows\usb_driver. So my computer does recognize the Android device.

However.. when I run an app on Eclipse, it still insists on opening it up in an emulator rather than my phone. How can I fix that?


回答1:


I just picked up Android development again, and this is what worked for me using HTC Hero (2.1 update 1) on Eclipse (v. 3.6 (Helios), Service Release 1):

  • Start up Eclipse
  • Connect the phone
  • Ensure USB debugging is enabled
  • Set phone connection type to HTC sync, as opposed to charge only, etc.
    (You don't have to sync, but it need to be in this mode. A message will then be displayed in the task bar saying USB debugging is connected or something similar. Then follow AlexVolovoy's instructions (Right click on the Eclipse project -> Run As -> Run Configuration -> Target - Choose manual) and you should be good to go. Just remember to pick your phone from the list of targets.



回答2:


See if this helps:

  • Right click on the Eclipse project -> Run As -> Run Configuration -> Target - Choose manual

The same goes for Debug.




回答3:


2 steps to follow

  1. Enable USB debugging mode in your android phone. settings > Applications > development > enable the "USB debugging" check box

  2. Enable manual deployment target on eclipse. Right Click on project > Run As > run configurations > select the "Target" tab > select the "Deployment Target Selection Mode" as ""manual""

Now run your application normally and you will be asked to choose the device you wanna run.

Then you can simply select the device you wish to run (Using serial number of the phone, if there are many devices running at the same time).




回答4:


On the phone, go to Settings -> Applications -> Development and make sure USB Debugging is enabled. (This location is from a Nexus One, it may be different on other Android versions)

I'm not sure all phones support this, the Android Dev Phone 1, Android Dev Phone 2, and the Nexus One do.

Once you do this, the phone should appear in the dialog you posted a link to in your comment on Alex's answer.



来源:https://stackoverflow.com/questions/2812442/debugging-an-android-app-to-the-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!