1.安装android-studio,这一步可省略.android studio 会在/home/*****/Android/Sdk目录下生成platform-tools文件夹
2.打开命令窗口,
先检查是否有存在fastboot
fenghuan@fenghuan-H81M-DS2:~$ whereis fastboot
fastboot: /usr/bin/fastboot /usr/bin/X11/fastboot
出现以上结果就代表有,先删除这个异常的.
fenghuan@fenghuan-H81M-DS2:~$ sudo rm -rf /usr/bin/fastboot
fenghuan@fenghuan-H81M-DS2:~$ whereis fastboot
fastboot:
然后使用以下命令
fenghuan@fenghuan-H81M-DS2:~$ sudo ln -s /code2/platform-tools/fastboot /usr/bin/fastboot
红色部分是绝对路径.
ADB操作方法同fastboot.
3.以上操作后,可能会遇到NO permission 的问题
解决方法:
先使用lsusb命令找到以下ID
fenghuan@fenghuan-H81M-DS2:~$ lsusb
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 101: ID 0e8d:201c MediaTek Inc.
Bus 003 Device 003: ID 04d9:a09e Holtek Semiconductor, Inc.
Bus 003 Device 002: ID 2516:0047
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
继续终端输入
fenghuan@fenghuan-H81M-DS2:~$ sudo gedit /etc/udev/rules.d/70-android.rules
在里面添加以下内容
SUBSYSTEM==“usb”, ATTRS{idVendor}“0e8d”, ATTRS{idProduct}“201c”,MODE=“0666”
注意红色部分对应起来.不同机器可能有差异.
终端输入
fenghuan@fenghuan-H81M-DS2:~$ sudo chmod a+rx /etc/udev/rules.d/70-android.rules
fenghuan@fenghuan-H81M-DS2:~$ sudo service udev restart
4.拔掉usb,重新连上(很重要),再执行:
fenghuan@fenghuan-H81M-DS2:~$ sudo adb kill-server
fenghuan@fenghuan-H81M-DS2:~$ sudo adb start-server
fenghuan@fenghuan-H81M-DS2:~$ adb devices
这样应该就能看设备.
如果不行,继续以下方式:
(1)、 lsusb,找到本设备对应的vid。
fenghuan@fenghuan-H81M-DS2:~$ lsusb
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 101: ID 0e8d:201c MediaTek Inc.
Bus 003 Device 003: ID 04d9:a09e Holtek Semiconductor, Inc.
Bus 003 Device 002: ID 2516:0047
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
(2)、 打开或者新建 ~/.android/adb_usb.ini文 件。
sudo gedit ~/.android/adb_usb.ini
(3)、 将将0x0e8d写入文件。重新adb kill-server或者adb start-server
(4)、 fastboot devices命令提示“”或其他fastboot命令提示"no permissions"的问题
一般这种问题都是因为fastboot默认只有root权限才能执行
要想普通用户能够执行,则必须修改fastboot权限
$ which fastboot
进入此目录修改fastboot权限
$ sudo chown root:root fastboot
$ chmod +s fastboot
再运行fastboot命令,就正常了