原文地址:http://www.cnblogs.com/darin726/archive/2013/06/08/3126672.html
我老是忘了去配置SDK,以至于在使用adb命令的时候报出一些错误。现在就记录一下如何解决这个问题,以方便我自己查阅。
在执行adb root的时候遇到一个问题:adb :command not found
原因及解决方案:
重装完ubuntu没有配置sdk环境,需进行配置。
vim .bashrc
然后添加下面内容:
export ANDROID_HOME=/home/jerikc/tools/android/android-sdk-linux export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
然后运行
. .bashrc
解决error: insufficient permissions for device
sudo -s//或者在执行下列命令之前加上sodu root@android-ubuntu:platform-tools# adb kill-server root@android-ubuntu:platform-tools# adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
root@android-ubuntu:platform-tools# exit
我的环境:
OS:Ubuntu 12.10 & MIUI V5
手机:米1
android开发真机调试时,运行sudo ./adb devices 时,若有如下输出:
List of devices attached
???????????? no permissions
解决办法:
- lsusb
以下是我的输出(当前连的是小米手机)
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 062a:0000 Creative Labs Optical mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 007: ID 18d1:9025 Google Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- 注意上面输出的蓝色一行:
Bus 001 Device 007: ID 18d1:9025 Google Inc.
- 创建rules文件
sudo vi/etc/udev/rules.d/51-android.rules
- 在末尾增加文件内容:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="9025", MODE="0600"
- 保存后给予权限:
sudo chmod a+rx/etc/udev/rules.d/51-android.rules
- sudo /etc/init.d/udev restart 或者 sudo
restartudev - sudo ./adb kill-server
- sudo ./adb start-server
- sudo ./adb devices
http://blog.csdn.net/coffeeco/article/details/12231869