1.adb devices不显示手机
有一些厂家没有申请到google的adb_usb pid号,所以不能够连接adb。
Linux修改方法 : 手机插入usb选好开发模式,lsusb 可以看到多出那个usb 的pid号,加入 ~/.android/adb_usb.ini
重启adb即可
Bus 003 Device 015: ID 9bb5:0c01中的9bb5即是pid。写入的pid要是16进制的,即要输入0x9bb5
Windows修改方法:首先确保已经安装好手机驱动。控制面板----》设备管理,找到手机设备,右击,选择属性,在详细信息栏,属性中选择硬件ID
然后在C:\Users\DFZ\.android文件中修改或新建adb_usb.ini,在其中加入vid_后面的数字,即0x9bb5,重启adb即可。
2.sudo: adb: command not found
http://stackoverflow.com/questions/257616/sudo-changes-path-why
This is an annoying function of sudo on ubuntu. Note this doesn't happen on fedora for example as sudo is not built with the --with-secure-path option there.
To work around this "problem" on ubuntu I do the following in my ~/.bashrc
alias sudo='sudo env PATH=$PATH'
如此修改后,每次重启终端后都要重新设置才行,可以修改~/.bashrc文件,将改段文字加入其中,重启终端即可
3.不想每次执行sudo都要输入密码可执行如下步骤:
sudo vim /etc/sudoers
将%sudo ALL=(ALL:ALL) ALL改为%sudo ALL=(ALL:ALL)NOPASSWD:ALL即可