仅用于计算机是Windows操作
1.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.
我们就直接了当的在Eclipse里,在AndroidManifest.xml中<application>里加上android:debuggable="true"
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.
就是把手机的USB调试模式打开,方法是(我以HTC Desire HD为例):Menu>设置>应用程序>开发>勾选”USB调试“
3.If you're developing on Windows, you need to install a USB driver for adb. If you're using an Android Developer Phone (ADP), Nexus One, or Nexus S, see theGoogle Windows USB Driver. Otherwise, you can find a link to the appropriate OEM driver in the OEM USB Drivers document.
就是把手机用USB线连到电脑上,安装驱动程序,Win7会自动安装,如若没有自动安装,在各手机网站的技术支持里找到驱动并下载。
4.在Eclipse里点Run>Run(或Debug),这时会弹出一个窗口,让你选择用模拟器还是手机来显示,选择手机,再看看手机上是不是出现了运行结果呢?呵呵。
图中第一个是模拟器,第二个就是我的手机,呵呵。
以下是在模拟器上运行的效果:
再来一张手机上的效果展示: