10下配置Android开发真机连接调试,Ubuntu下解决不

2019-07-16 22:57栏目:关于计算机

第一明确手提式无线电话机总是上Ubuntu计算机,lsusb查看下设备记录。

手提式有线电话机连接上台式机后,在表弟大中的usb调节和测量检验应当要翻开,然后在terminal中键入“lsusb”

www.linuxidc.com @linuxidc:~$ lsusb
Bus 007 Device 009: ID 18d1:4e12
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 004: ID 093a:2510 Pixart Imaging, Inc.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub小编那边是:

www.linuxidc.com @linuxidc:~$ lsusb
Bus 003 Device 002: ID 04fc:05da Sunplus Technology Co., Ltd
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 0bb4:0c91 High Tech Computer Corp.
Bus 001 Device 005: ID 0bda:0158 Realtek Semiconductor Corp. USB 2.0 multicard reader
Bus 001 Device 002: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 007 Device 009: ID 18d1:4e12然后在/etc/udev/rules.d/下开创七个配置文件: 51-Android.rules

笔者是htc手提式有线电话机,故 Bus 001 Device 007: ID 0bb4:0c91 High Tech ComputerCorp.正是自身的手提式有线电话机设备,注意ID后的0bb4,比较重大,下文再讲。

sudo vim /etc/udev/rules.d/50-android.rules文件里增多如下配置参数:

跟着键入“cd /etc/udev/rules.d/”

SUBSYSTEM=="usb", SYSFS{"High Tech 计算机 Corp."}=="0bb4", MODE="0666"保存,给配备文件设置下放权力限

www.linuxidc.com @linuxidc:~$ cd /etc/udev/rules.d/
www.linuxidc.com @linuxidc:/etc/udev/rules.d$

sudo chmod a rx /etc/udev/rules.d/50-android.rulesRestart

进去到此目录下,新建文书档案“50-Android.rules”

sudo /etc/init.d/udev restart最终再重启下adb服务,就能够了(没安排情状变量的请进来Android SDK tools目录实行sudo ./adb kill-server ./adb devices)

www.linuxidc.com @linuxidc:/etc/udev/rules.d$ sudo gedit 50-android.rules

sudo adb kill-server
sudo adb devices补充
SYSFS参数:

名字应该是不管三七二十一的,不过英特网的科目都以叫这些,于是本身也如此命名,步入文书档案后,输入以下两行内容

SYSFS{"idVendor"}="xxx"针对Linux ADB驱动配置文件里的SYSFS参数是指设备厂家。当初因为是小米帮谷歌(Google)做的无绳电话机,所以官方网址一同头的用例上写的是”High Tech 计算机 Corp.”。但前段时间Moto, One plus, 三星(Samsung)等一群手机商家的步向,Android生产商家已不止红米一家。而且且要是设备型号不是0bb4这该如何做呢?

SUBSYSTEM =="usb" , SYSFS{ "High Tech Computer Corp." } =="0bb4" , MODE ="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"

读sdk援助文书档案的时候,开掘sdk已经提供了证实:
(详见:docs/guide/developing/device.html)

我们能够观察,因为自身的手机刚才ID后的是0bb4,所以率先行中的 SYSFS{ "High Tech Computer Corp." } =="0bb4"那样写,要是你的手提式无线电话机不是htc的,能够因而“lsusb”查看详细情况后,照着样子修改,第二行原样复制就能够。本来一初叶只写了第一行,试了非凡,后来网络找到第二行,说是万能写法,就也写在背后,结果成功了,读者最棒也像那样两行都写。

If you’re developing on Ubuntu Linux, you need to add a rules file that contains a USB configuration for each type of device you want to use for development. Each device manufacturer uses a different vendor ID. The example rules files below show how to add an entry for a single vendor ID (the HTC vendor ID). In order to support more devices, you will need additional lines of the same format that provide a different value for the SYSFS{idVendor} property. For other IDs, see the table of USB Vendor IDs, below.

文书档案内容达成后给予全部人全数权力“sudo chmod 777 50-android.rules”

  1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.

www.linuxidc.com @linuxidc:/etc/udev/rules.d$ sudo chmod 777 50-android.rules

For Gusty/Hardy, edit the file to read: [注:ubuntu 7.10及随后版本]
SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″

接下来输入“sudo /etc/init.d/udev restart”,对usb设备重启连接。

For Dapper, edit the file to read: [注:ubuntu 6.06及之前版本]
SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”0bb4″, MODE=”0666″

下一场走入android sdk解压的门路,进入platform-tools

  1. Now execute:
    chmod a r /etc/udev/rules.d/51-android.rules

www.linuxidc.com @linuxidc:/etc/udev/rules.d$ cd /home/ritter/android-sdk-linux_86/platform-tools/
www.linuxidc.com @linuxidc:~/android-sdk-linux_86/platform-tools$

要是依据表明把创制的51-android.rules文件中的0bb4改造为对应的USB供应商ID新闻就能够。
比方说本身的无绳电话机是moto松本穗香,idVender是22b8
那正是说这一行就是

输入“ sudo ./adb  kill-server”

SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"可是,你能够写多行,以应用各样器材。比方小编就写了具有的,如下:

www.linuxidc.com @linuxidc:~/android-sdk-linux_86/platform-tools$ sudo ./adb  kill-server

#Acer      0502
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
#Dell     413c
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
#Foxconn     0489
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
#Garmin-Asus     091E
SUBSYSTEM=="usb", SYSFS{idVendor}=="091e", MODE="0666"
#HTC     0bb4
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
#Huawei     12d1
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
#Kyocera     0482
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
#LG     1004
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
#Motorola     22b8
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
#Nvidia     0955
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
#Pantech     10A9
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
#Samsung     04e8
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
#Sharp     04dd
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
#Sony Ericsson     0fce
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
#ZTE     19D2
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"可是那上边的ID,并无法包蕴富有,作者手上就有一台设备的USB ID就不在上述之列。
消除办法是你可以动用lsusb命令查看你的USB ID

然后输入“sudo ./adb  start-server”

www.linuxidc.com @linuxidc:~$ lsusb
Bus 002 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
Bus 002 Device 002: ID 0461:4d22 Primax Electronics, Ltd
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 010: ID 18a1:0002
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub找到地点的ID为18a1,在文书中丰富设备就足以了。

www.linuxidc.com @linuxidc:~/android-sdk-linux_86/platform-tools$ sudo ./adb  start-server

SUBSYSTEM=="usb", SYSFS{idVendor}=="18a1", MODE="0666"修改/etc/udev/rules.d/51-android.rules无需重启Linux机器,重新插拔一下设施就可以了。再一次运转adb devices就能够看出您的装置已经延续

* daemon not running. starting it now on port 5037 *
* daemon started successfully *

www.linuxidc.com @linuxidc:/opt/android/android-sdk-linux_86/tools$ sudo ./adb devices
List of devices attached
040350二〇〇一01一千    device而在此以前,你或者看到的是

下一场输入“./adb devices”

www.linuxidc.com @linuxidc:/opt/android/android-sdk-linux_86/tools$ sudo ./adb devices
List of devices attached
????????????    no permissions

www.linuxidc.com @linuxidc:~/android-sdk-linux_86/platform-tools$ ./adb devices

图片 1

List of devices attached
SH0B5RT08771 device

那时,笔者的手提式有线电话机配备号已经不错展现了。表达真机连接成功,此时在eclipse中一旦配置run configurations中的target为手提式有线电话机配备就足以将程序安装到真机中调弄整理了。

Ps:

下一次连日时,假设设备彰显为“????????”时,记住要跻身android SDK下的platforms-tools中

执行

sudo ./adb kill-server

sudo ./adb devices

就可以看见准确识别的配备了

图片 2

版权声明:本文由威尼斯网站发布于关于计算机,转载请注明出处:10下配置Android开发真机连接调试,Ubuntu下解决不