How to install the Android ADB driver in Linux

Source: Internet
Author: User
Document directory
  • Overview
  • Procedure
  • Supplement
Android ADB Driver Installation in Linux

Recently, due to the large number of built-in partners, many Android mobile phones of many manufacturers in my Ubuntu system cannot be correctly identified. After some hard work, I checked the SDK, now we have sorted out the ADB driver configuration methods in Linux and solutions to the problems encountered in them and contributed them to you.

In Linux, you can connect to ADB in Mobile USB debugging mode for Android program debugging. The configuration driver is not intuitive in Windows.

Procedure

First confirm that the mobile phone is connected to the computer, lsusb to view the device records.

matthew@matthew-1230-laptop:~$ lsusbBus 007 Device 009: ID 18d1:4e12Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 004: ID 093a:2510 Pixart Imaging, Inc.Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Here I am:

Bus 007 Device 009: ID 18d1:4e12

Create a configuration file 51-android.rules under/etc/udev/rules. d /.

sudo vim /etc/udev/rules.d/50-android.rules

Add the following configuration parameters to the file:

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

Save, Set permissions for the configuration file

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

Restart

sudo /etc/init.d/udev restart

Then restart the adb service. (If NO environment variable is configured, go to the Android SDK tools directory and run sudo./adb kill-server./adb devices)

sudo adb kill-serversudo adb devices
Supplement

SYSFS parameters:

SYSFS{"idVendor"}="xxx"

The SYSFS parameter in the Linux ADB driver configuration file refers to the device vendor. Because it was a mobile phone made by HTC for Google, "High Tech Computer Corp." was first written on the official website .". But now, a group of mobile phone manufacturers, such as Moto, Sony Ericsson, and Samsung, have joined more than HTC. What should I do if the device model is not 0bb4?

When reading the sdk help documentation, I found that the sdk has provided instructions:
(For details, see docs/guide/developing/device.html)

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

USB Vendor IDs, below.

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

For gusty/hard, edit the file to read: [Note: Ubuntu 7.10 and later versions]
Subsystem = "USB", sysfs {idvendor} = "0bb4", mode = "0666 ″

For dapper, edit the file to read: [Note: Ubuntu 6.06 and earlier versions]
Subsystem = "usb_device", sysfs {idvendor} = "0bb4", mode = "0666 ″
2. Now execute:
Chmod A + R/etc/udev/rules. d/51-android.rules

Follow the instructions to change 0bb4 in the 51-android.rules file to the corresponding USB vendor ID.
For example, my mobile phone is motorola and idVender is 22b8.
So this line is

SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"

However, you can write multiple lines to use various devices. For example, I wrote all the following:

#Acer      0502SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"#Dell     413cSUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"#Foxconn     0489SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"#Garmin-Asus     091ESUBSYSTEM=="usb", SYSFS{idVendor}=="091e", MODE="0666"#HTC     0bb4SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"#Huawei     12d1SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"#Kyocera     0482SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"#LG     1004SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"#Motorola     22b8SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"#Nvidia     0955SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"#Pantech     10A9SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"#Samsung     04e8SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"#Sharp     04ddSUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"#Sony Ericsson     0fceSUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"#ZTE     19D2SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"

However, the above IDs cannot include all of them. The usb id of a device is not listed above.
You can use the lsusb command to view your usb id.

matthew@matthew-1230-laptop:~$ lsusbBus 002 Device 003: ID 413c:2003 Dell Computer Corp. KeyboardBus 002 Device 002: ID 0461:4d22 Primax Electronics, LtdBus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 001 Device 010: ID 18a1:0002Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Find the above ID as 18a1 and add the device to the file.

SUBSYSTEM=="usb", SYSFS{idVendor}=="18a1", MODE="0666"

Modify/etc/udev/rules. d/51-android.rules. You do not need to restart the Linux machine and re-plug the device. Run adb devices again to see that your device is connected.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.