Adb 设备命令不工作

我运行的是 Ubuntu 10.1064位,安装了 ia32-libs 和 Android Debug Bridge 1.0.26版本。

我的问题:

  1. 没有许可
  2. Sudo: adb: 未找到命令
  3. adb shell > > > 错误: 设备权限不足

我想这些都是相关的,这是相关信息。

$ echo $PATH
/home/me/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/android-sdk-linux_x86/tools:/opt/android-sdk-linux_x86/platform-tools


$ which adb
/opt/android-sdk-linux_x86/platform-tools/adb


$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
????????????    no permissions


$ sudo adb devices
sudo: adb: command not found


$ adb shell
error: insufficient permissions for device

对于运行 CM6.1的根 Moto Droid 和运行基于 CM7的 ROM 的根 G-Tab,我得到了相同的结果。

我审查了以下相关职位:

我尝试了大部分(不是全部)的建议,但我还是没能解决我的问题。我没有尝试的东西似乎不合适。我希望你能多给我一些建议,我会继续进行故障排除。

我没有尝试编辑/etc/udev/rules. d/70-android。规矩。这可能是问题所在吗?我看不出这会导致“ sudo: adb: command not found”。也许我的问题不全是相关的。无论如何,在这一点上,我认为我需要一些来自其他人的意见,因为我不相信我有一个路径问题或其他共同的问题讨论在那些其他职位。

编辑: 多亏了 EboMike 和 RivieraKid,这个问题才得以解决。这实际上是两个不同的问题:

  1. 上面的第2项(sudo: adb: command not found)是通过创建符号链接解决的,如下所示:

    $ sudo ln -s /opt/android-sdk-linux_x86/platform-tools/adb /usr/local/sbin/adb
    

    这使我能够按照 EboMike 的建议使用 这个解决方案。我的摩托机器人需要这么做。(不过,我的优派 G-Tablet 需要的是像 sudo 那样运行 adb 的 没有。)

  2. 我的另外两个项目是通过实现 RivieraKid 建议的 udev 规则来解决的(来自这个 链接)。

127399 次浏览

You need to restart the adb server as root. See here.

One thing I didn't try was editing /etc/udev/rules.d/70-android.rules. Is that likely to be the issue?

Any particular reason why you didn't do that? To answer the question - YES! The udev rules are what informs Ubuntu what your device is and allows user-space tools to therefore access it.

You will not be able to use adb without correctly following the instructions.

With that in mind however, you don't say what version of Ubuntu you're using but I had issues with 10.10 - let me know if you need me to post the contents of my rules file.

Don't worry about running adb via sudo, you don't need it. The MODE="0666" from the udev rule allows you to access the device as any user.


EDIT:

Don't forget to reload the rules:

sudo udevadm control --reload-rules

EDIT #2:

As @Jesse Glick correctly points out, if adb is already running in daemon mode, you'll also need to restart it for this to work:

sudo adb kill-server

I've used sudo here, since that will guarantee that adb will be killed , and it's the officially supported method to stop the server. It will be automatically restarted the next time adb is used, but this time with the correct environment.

I fixed this issue on my debian GNU/Linux system by overiding system rules that way :

mv  /etc/udev/rules.d/51-android.rules /etc/udev/rules.d/99-android.rules

I used contents from files linked at : http://rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/

On my Gentoo/Funtoo linux system I am having similar problems:

I gotting always not the correct device description and insufficient permissions:

# sudo ./adb devices
List of devices attached
????????????    no permissions
# ./adb usb
error: insufficient permissions for device

For me helps the howto from Google. In my case I needed to add the udev rule:

# cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

and setting up the filesystem rights

# chmod a+r /etc/udev/rules.d/51-android.rules

After replugging my smartphone the access to the phone was successful, it also appears now in Eclipse' Android Device Chooser:

# sudo ./adb devices
List of devices attached
3XXXXXXXXXXXXXC device
# sudo ./adb usb
restarting in USB mode

You also have to check the membership of your user to the plugdev-group.

Please note that IDEs like IntelliJ IDEA tend to start their own adb-server.

Even manually killing the server and running an new instance with sudo won't help here until you make your IDE kill the server itself.

Every answer I've read indicates the SUBSYSTEM=="usb". However, my (perhaps ancient) udev needed this to be changed to DRIVER=="usb". At last I can run the adb server as a non-root user... yay.

It can be instructive to look at the output of udevmonitor --env, followed by the output of

udevinfo -a -p <DEVICE_PATH_AS_REPORTED_BY-udevmonitor>

HTC One m7 running fresh Cyanogenmod 11.

Phone is connected USB and tethering my data connection.

Then I get this surprise:

cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb shell
error: insufficient permissions for device


cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
????????????    no permissions

SOLUTION: Turn tethering OFF on phone.

cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
HT36AW908858    device

I just got the same situation, Factory data reset worked well for me.

restarting the adb server as root worked for me. see:

derek@zoe:~/Downloads$ adb sideload angler-ota-mtc20f-5a1e93e9.zip
loading: 'angler-ota-mtc20f-5a1e93e9.zip'
error: insufficient permissions for device
derek@zoe:~/Downloads$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX    no permissions


derek@zoe:~/Downloads$ adb kill-server
derek@zoe:~/Downloads$ sudo adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
derek@zoe:~/Downloads$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX    sideload