adb devices 命令不起作用
我正在运行 Ubuntu 10.10 64 位。我已随 Android 调试桥版本 1.0.26 一起安装了 ia32-libs。
我的问题:
adb devices
>>> ????????????没有权限sudo adb devices
>>>> sudo:adb:找不到命令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 的 root Moto Droid 和运行基于 CM7 的 ROM 的 root G-Tab 得到了相同的结果。
我已查看以下相关帖子:
- http://forum。 xda-developers.com/archive/index.php/t-522827.html
- http://ubuntuforums.org/archive/index.php/t-1164359.html
- adb 命令在 Linux 环境中找不到
我尝试了大部分(不是全部)建议,但无法解决我的问题。我没有尝试的事情似乎不合适。我希望得到更多提示,并且我会继续排除故障。
我没有尝试的一件事是编辑/etc/udev/rules.d/70-android.rules。这可能是问题所在吗?我看不出这会如何导致“sudo:adb:找不到命令”。也许我的问题并不都是相关的。无论如何,在这一点上,我认为我需要其他人的一些意见,因为我不相信我有路径问题或其他帖子中讨论的其他常见问题。
编辑:已解决感谢 EboMike 和 RivieraKid。这实际上是两个不同的问题:
I'm running Ubuntu 10.10 64 bit. I have ia32-libs installed along with Android Debug Bridge version 1.0.26.
My problem(s):
adb devices
>>> ???????????? no permissionssudo adb devices
>>>> sudo: adb: command not foundadb shell
>>> error: insufficient permissions for device
I guess these are all related. Here's the relevant info.
$ 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
I get the same results with a rooted Moto Droid running CM6.1 and a rooted G-Tab running a CM7-based ROM.
I have reviewed the following related posts:
- http://forum.xda-developers.com/archive/index.php/t-522827.html
- http://ubuntuforums.org/archive/index.php/t-1164359.html
- adb command not found in linux environment
I tried most (not all) of the suggestions and I have not been able to resolve my issue. The things I didn't try seemed inappropriate. I would appreciate a few more tips and I'll keep troubleshooting.
One thing I didn't try was editing /etc/udev/rules.d/70-android.rules. Is that likely to be the issue? I can't see how that would cause "sudo: adb: command not found". Maybe my problems are not all related. Anyway, at this point I think I need some input from other people because I don't believe I have a path problem or the other common problems discussed in those other posts.
EDIT: SOLVED thanks to EboMike and RivieraKid. This was actually two different problems:
Item #2 above (sudo: adb: command not found) was solved by making a symlink as follows:
$ sudo ln -s /opt/android-sdk-linux_x86/platform-tools/adb /usr/local/sbin/adb
That allowed me to then do as EboMike suggested and use this solution. Doing that was required for my Moto Droid. (Running adb as sudo was not required for my Viewsonic G-Tablet, however.)
My other two items were resolved by implementing the udev rule as RivieraKid suggested (from this link).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
在我的 Gentoo/Funtoo linux 系统上,我遇到了类似的问题:
我总是得到不正确的设备描述和权限不足:
对我来说有助于 howto。
就我而言,我需要添加 udev 规则:
并设置文件系统权限
重新插入智能手机后,对手机的访问成功,它现在也出现在 Eclipse 的 Android 设备选择器中:
您还必须检查用户的成员身份到 plugdev 组。
On my Gentoo/Funtoo linux system I am having similar problems:
I gotting always not the correct device description and insufficient permissions:
For me helps the howto from Google.
In my case I needed to add the udev rule:
and setting up the filesystem rights
After replugging my smartphone the access to the phone was successful, it also appears now in Eclipse' Android Device Chooser:
You also have to check the membership of your user to the plugdev-group.
我读过的每个答案都表明
SUBSYSTEM==“usb”
。然而,我的(也许是古老的)udev 需要将其更改为 DRIVER==“usb”。最后我可以以非 root 用户身份运行 adb 服务器...耶。查看 udevmonitor --env 的输出以及后面的输出可能会很有启发性
Every answer I've read indicates the
SUBSYSTEM=="usb"
. However, my (perhaps ancient) udev needed this to be changed toDRIVER=="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
请注意,像 IntelliJ IDEA 这样的 IDE 往往会启动自己的 adb-server。
即使手动终止服务器并使用 sudo 运行新实例也无济于事,除非您让 IDE 终止服务器本身。
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.
以 root 身份重新启动 adb 服务器对我有用。看:
restarting the adb server as root worked for me. see:
我通过这种方式覆盖系统规则在我的 debian GNU/Linux 系统上解决了这个问题:
我使用了链接到的文件中的内容:
http:// rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/
I fixed this issue on my debian GNU/Linux system by overiding system rules that way :
I used contents from files linked at :
http://rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/
HTC One m7 运行新的 Cyanogenmod 11。
手机已连接 USB 并限制我的数据连接。
然后我得到了这个惊喜:
解决方案:关闭手机上的网络共享。
HTC One m7 running fresh Cyanogenmod 11.
Phone is connected USB and tethering my data connection.
Then I get this surprise:
SOLUTION: Turn tethering OFF on phone.
我刚刚遇到了同样的情况,恢复出厂设置对我来说效果很好。
I just got the same situation, Factory data reset worked well for me.
你没有这样做的具体原因是什么?回答这个问题——是的! udev 规则告诉 Ubuntu 你的设备是什么,并允许用户空间工具访问它。
如果不正确遵循说明,您将无法使用 adb。
然而,考虑到这一点,你没有说你正在使用哪个版本的 Ubuntu,但我在 10.10 上遇到了问题 - 如果你需要我发布我的规则文件的内容,请告诉我。
不用担心通过 sudo 运行 adb,你不需要它。 udev 规则中的
MODE="0666"
允许您以任何用户身份访问设备。编辑:
不要忘记重新加载规则:
编辑#2:
正如 @Jesse Glick 正确指出的那样,如果 adb 已经在守护进程模式下运行,您还需要重新启动它才能正常工作:
我使用了 sudo在这里,因为这将保证 adb 将被终止,并且这是官方支持的停止服务器的方法。下次使用 adb 时它将自动重新启动,但这次使用了正确的环境。
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:
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:
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.
您需要以 root 身份重新启动 adb 服务器。请参阅此处。
You need to restart the adb server as root. See here.