曦远 (DealiAxy)一份私人的文字刊物

StarBlog
返回文章列表折页手记阅读全文
Android开发

Android Development: Using ADB to Connect an Android Phone on Linux

Introduction Due to Linux system security settings and other reasons, non-root users are restricted when using external devices or certain hardware interfaces. The official SDK provided by Google cannot work directly, such as not finding the device or displaying a bunch of question marks and Permission Denied. Method I remember seeing Google's official solution before, which is to grant read and write permissions for specified USB devices to ordinary users. First use the lsusb command to view the USB devices connected to the computer, find A

曦远 (DealiAxy)约 5 分钟
目录2 个章节

Introduction

Due to Linux system security settings and other reasons, non-root users are restricted when using external devices or certain hardware interfaces. The official SDK provided by Google cannot work directly, such as not finding the device or displaying a bunch of question marks and Permission Denied.

Method

I remember seeing Google's official solution before, which is to grant read and write permissions for specified USB devices to ordinary users.

First, use the lsusb command to view the USB devices connected to the computer, find the vendor ID and product ID corresponding to the Android phone, such as Bus 001 Device 004: ID 0bda:0001, then 0bda and 0001 correspond to the vendor ID and product ID respectively.

Tip: Check the lsusb results once before connecting the phone; after connecting the phone, find the newly added line in lsusb. Some small domestic manufacturers may set their vendor ID to Google's or HTC's. It doesn't really matter what the vendor ID is set to; it's just an identifier.

Second step, edit the /etc/udev/rules.d/70-android.rules file. Write the following content (tested on Ubuntu):

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="0001",MODE="0666"

Replace 0bda and 0001 with the corresponding vendor ID and product ID respectively.

Third step, grant read and execute permissions: chmod a+rx /etc/udev/rules.d/70-android.rules

Finally, unplug the phone, restart adb and plug the phone back in: adb kill-server

Check the device list to verify success adb devices

Actually, connecting an Android phone on Linux is much more convenient than on Windows; at least you don't have to search all over the world for drivers.

_EOF_

Android Development: Using ADB to Connect an Android Phone on Linux

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

Android开发:对Gradle的折腾记录

前言 有点烦,最近给电脑升级一下配置,加了内存和固态硬盘,结果新内存不太兼容,导致电脑频繁死机,去找商家换了一条内存之后就好了,这也导致我贸然重装了系统 = =... 有一点资料放在系统盘忘记保存结果丢了。今天下午才把新系统配置好,所以这两天都没有办法写推文。 (不得不说Chrome真是好用,这同步功能免去了很多麻烦。) 首先喷一下Gradle 缺点:占用资源大,速度又慢,在国内用网络还很差。 今

2022-05-27 · Android开发 · 约 1 分钟

该死的应用闪退,终于解决error-while-inflating-CardView

前言 (先来一个微笑脸)这个问题已经困扰我好久了,之前各种搜索无果,得到的解决方案无非就是 AppCompact 和 CardView 包的版本不一样云云,然而我根本没有这个问题。(怕是不把我Gradle看在眼里?) 问题 就是这么个界面,用到了RecycleView和Cardview,但是在SDK 23以下都不行,官方已经写明这个组件是支持到SDK9还是10的,反正基本是个android手机就可

2022-08-22 · Android开发 · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…