ubuntu環境下執行adb shell 時報錯 error: device not found.
解決方法:
1.使用lsusb 查看usb設備,如下紅色部分對應的就是android設備
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 0461:4e04 Primax Electronics, Ltd
Bus 003 Device 011: ID 2717:9039
Bus 003 Device 003: ID 17ef:6019 Lenovo
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
若不知道哪個是你的設備,可以拔掉後lsusb,然後對比即可.
2.創建adb_usb.ini文件,寫入id
在home下尋找.android目錄,在此目錄下新建一個文件adb_usb.ini.
echo 0x2717> ~/.android/adb_usb.ini
3.添加權限
sudo vim /etc/udev/rules.d/70-android.rules
加入以下內容,注意紅色部分對應的就是lsusb得到的id
SUBSYSTEM=="usb", ATTRS{idVendor}=="2717", ATTRS{idProduct}=="9039",MODE="0666"
4.重啓USB服務
$sudo chmod a+rx /etc/udev/rules.d/70-android.rules
$sudo service udev restart
5.重啓adb服務,adb devices有設備說明adb安裝成功
$adb kill-server
$sudo adb start-server
$adb devices
List of devices attached
5cb00b6 device