ubuntu系统下android真机调试!

参考了如下文章:

关于android真机测试(linux系统下) http://blog.csdn.net/alfredtofu/article/details/7029170

由于在avd中测试一个程序的手势滑动功能。因为没有效果。也就是没有响应哪种。所以想用真机调试。

但是当我把手机(小米)与电脑相连时,eclipse中的devices中,出现了的的是这样的:


也就是????? ?? unkown。

调用命令行下的adb如下:


banxi1988@banxi:~$ echo $PATH
/home/banxi1988/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
banxi1988@banxi:~$ vi .bashrc
banxi1988@banxi:~$ source .bashrc 
banxi1988@banxi:~$ tail -n 3 .bashrc 
# add by banxi for android development 
PATH="$PATH:~/android/android-sdk-linux_x86/platform-tools:~/android/android-sdk-linux_x86/tools"
export PATH
banxi1988@banxi:~$ 
banxi1988@banxi:~$ echo $PATH
/home/banxi1988/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/android-sdk-linux_x86/platform-tools:~/android-sdk-linux_x86/tools
banxi1988@banxi:~$ adb devices
List of devices attached 
emulator-5554	device
????????????	no permissions

banxi1988@banxi:~$ 


首先不连手机不连电脑运行命令lsusb,如下:

banxi1988@banxi:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 058f:b002 Alcor Micro Corp. 
Bus 002 Device 003: ID 24ae:2000  
banxi1988@banxi:~$ 


然后手机连上电脑再一次lsusb,如下:


banxi1988@banxi:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 058f:b002 Alcor Micro Corp. 
Bus 002 Device 003: ID 24ae:2000  
Bus 002 Device 007: ID 18d1:9025 Google Inc. 
banxi1988@banxi:~$ 

对比发现多了:
Bus 002 Device 007: ID 18d1:9025 Google Inc. 
按照参考上的步骤如下,没有成功先:

banxi1988@banxi:~$ sudo vi /etc/udev/rules.d/50-android.rules
banxi1988@banxi:~$ cat /etc/udev/rules.d/50-android.rules 
SUBSYSTEM="usb",SYSFS"Google Inc"=18D1,MODE="0666"
banxi1988@banxi:~$ ls -l /etc/udev/rules.d/50-android.rules 
-rw-r--r-- 1 root root 51 2012-03-13 16:37 /etc/udev/rules.d/50-android.rules
banxi1988@banxi:~$ sudo chmod a+rx /etc/udev/rules.d/50-android.rules 
banxi1988@banxi:~$ ls -l /etc/udev/rules.d/50-android.rules 
-rwxr-xr-x 1 root root 51 2012-03-13 16:37 /etc/udev/rules.d/50-android.rules
banxi1988@banxi:~$ sudo /etc/init.d/udev restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service udev restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop udev ; start udev. The restart(8) utility is also available.
udev stop/waiting
udev start/running, process 8307
banxi1988@banxi:~$ sudo android/android-sdk-linux_x86/platform-tools/adb kill-server
banxi1988@banxi:~$ sudo android/android-sdk-linux_x86/platform-tools/adb devices
List of devices attached 
????????????	no permissions
emulator-5554	device

banxi1988@banxi:~$ sudo android/android-sdk-linux_x86/platform-tools/adb kill-server
banxi1988@banxi:~$ sudo android/android-sdk-linux_x86/platform-tools/adb start-server
banxi1988@banxi:~$ android/android-sdk-linux_x86/platform-tools/adb devices
List of devices attached 
????????????	no permissions
emulator-5554	device

banxi1988@banxi:~$ 


仔细检查发现是一个大小写错误:

改正后,设备发现成功,哈哈,如下:

banxi1988@banxi:~$ sudo vi /etc/udev/rules.d/50-android.rules
banxi1988@banxi:~$ cat /etc/udev/rules.d/50-android.rules SUBSYSTEM="usb",SYSFS"Google Inc"=18d1,MODE="0666"
banxi1988@banxi:~$ sudo service udev restart
udev start/running, process 8408
banxi1988@banxi:~$ sudo android/android-sdk-linux_x86/platform-tools/adb kill-server
banxi1988@banxi:~$ sudo android/android-sdk-linux_x86/platform-tools/adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
banxi1988@banxi:~$ adb devices
List of devices attached 
emulator-5554	device
0170e1e7	device

banxi1988@banxi:~$ 

然后就可以选择在真机上运行了哈哈。


可是,最后我发现不是模拟器的问题,是我程序的问题,因为在真机上也没有反应的。


你可能感兴趣的:(ubuntu系统下android真机调试!)