Linux 在 Ubuntu 上找不到命令 'adb' 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20532440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'No command 'adb' found' error on Ubuntu
提问by rumit patel
I just got a brand new Ubuntu machine and I am trying to setup Android SDK. I am pretty new to Unix so pardon me if I did a silly mistake.
我刚买了一台全新的 Ubuntu 机器,我正在尝试设置 Android SDK。我对 Unix 很陌生,所以如果我犯了一个愚蠢的错误,请原谅我。
I followed the instructions given here, all the way up to adding the 'Rule' file. Now if I try adb devices
in the terminal, it gives me 'No command 'adb' found' error and asks if I made a spelling mistake.
我按照这里给出的说明,一直到添加“规则”文件。现在,如果我adb devices
在终端中尝试,它会给我“No command 'adb' found”错误并询问我是否拼写错误。
@USER:~/android-sdk-linux/platform-tools$ ls
NOTICE.txt adb api fastboot source.properties systrace
@USER:~/android-sdk-linux/platform-tools$ adb devices
No command 'adb' found, did you mean:
Command 'cdb' from package 'tinycdb' (main)
Command 'gdb' from package 'gdb' (main)
Command 'dab' from package 'bsdgames' (universe)
Command 'zdb' from package 'zfs-fuse' (universe)
Command 'kdb' from package 'elektra-bin' (universe)
Command 'tdb' from package 'tads2-dev' (multiverse)
Command 'pdb' from package 'python' (main)
Command 'jdb' from package 'openjdk-6-jdk' (main)
Command 'jdb' from package 'openjdk-7-jdk' (universe)
Command 'ab' from package 'apache2-utils' (main)
Command 'ad' from package 'netatalk' (universe)
adb: command not found
I searched through a couple of questions on StackOverflowand some suggest I use apt-get install ia32-libs
command to get some 32-bit libraries. However, I am on a 64-bit machine so not sure whether I should go for that or not.
我在 StackOverflow 上搜索了几个问题,有些人建议我使用apt-get install ia32-libs
命令来获取一些 32 位库。但是,我在 64 位机器上,所以不确定我是否应该这样做。
Another strange issue I noticed is, even if I navigate to the platform-tools
folder and execute adb devices
command, I get the same error. So, I might be missing something else here rather than incorrectly setting the PATH entry.
我注意到的另一个奇怪的问题是,即使我导航到platform-tools
文件夹并执行adb devices
命令,我也会遇到同样的错误。所以,我可能在这里遗漏了其他东西,而不是错误地设置了 PATH 条目。
I tried both the ADB BUNDLE (.zip file) and SDK tools (.tgz file) from the download pageand completed all the steps mentioned above but got same error.
我从下载页面尝试了 ADB BUNDLE(.zip 文件)和 SDK 工具(.tgz 文件)并完成了上述所有步骤,但遇到了同样的错误。
I am on Ubuntu 12.04 LTS.
我在 Ubuntu 12.04 LTS 上。
采纳答案by rumit patel
I'm not sure what this line did and why I had to do that ('cuz the blogs say its some 32-bit libraries and I am on a 64-bit machine). But it seems to be working for me.
我不确定这条线做了什么以及为什么我必须这样做(因为博客说它有一些 32 位库,而我在 64 位机器上)。但它似乎对我有用。
sudo apt-get install ia32-libs
When I executed this command, it installed/added some stuff for about 5 minutes (literally) and then everything worked.
当我执行这个命令时,它安装/添加了一些东西大约 5 分钟(字面意思),然后一切正常。
Regards, Rumit
问候, 鲁米特
回答by abasterfield
You are in the right directory but the current directory is not in your shell's command search path.
您位于正确的目录中,但当前目录不在 shell 的命令搜索路径中。
Try
尝试
./adb
Also search Google for how to set $PATH variable in bash
还可以在 Google 上搜索如何在 bash 中设置 $PATH 变量
Type the following into your terminal (from your help.ubuntu.com URL) - it will temporarily add the android tool directories into your PATH for that shell/terminal
在您的终端中键入以下内容(来自您的 help.ubuntu.com URL) - 它将临时将 android 工具目录添加到您的 shell/终端的 PATH 中
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
You should now be able to run adb (without being in the right dir and without using ./adb)
您现在应该能够运行 adb(无需在正确的目录中,也无需使用 ./adb)
If you add those commands into your .bashrc and start a new terminal/shell you should find those changes are now permanent.
如果您将这些命令添加到您的 .bashrc 并启动一个新的终端/shell,您应该会发现这些更改现在是永久性的。
回答by Nikhil Raut
Make sure you installed:
确保您安装了:
sudo apt-get install android-tools-adb
Now check:
现在检查:
sudo adb
It will show adb help.
它将显示 adb 帮助。
Now please kill/start adb. Use the following commands:
现在请杀死/启动 adb。使用以下命令:
sudo adb kill-server
sudo adb start-server
Lastly, do:
最后,做:
sudo adb devices
This should work.
这应该有效。
回答by Nithin Raja
In platform-tools folder "adb" is available then follow these steps:
在平台工具文件夹“adb”可用,然后按照以下步骤操作:
Set android vars
设置安卓变量
Initially go to your home and press Ctrl + H
it will show you hidden files now look for .bashrc file, open it with any text editor then place the lines below at the end of file:
最初去你的家并按下Ctrl + H
它会显示隐藏文件,现在查找 .bashrc 文件,用任何文本编辑器打开它,然后将下面的行放在文件末尾:
export ANDROID_HOME=/myPathSdk/android-sdk-linux export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ANDROID_HOME=/myPathSdk/android-sdk-linux export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Now Reboot the system
现在重启系统
It Works!
有用!
回答by pradip tilala
(My system is ubuntu 16.10)
(我的系统是ubuntu 16.10)
This will make the android studio to find the adb-->
这将使android studio 找到adb-->
1) Open with gedit: (ref:https://askubuntu.com/questions/127056/where-is-bashrc)
1)用gedit打开:(参考:https: //askubuntu.com/questions/127056/where-is-bashrc)
gedit ~/.bashrc
gedit ~/.bashrc
2) Add this line to the bottom of your.bashrc and it works.
2) 将此行添加到 your.bashrc 的底部,它就可以工作了。
export PATH=$PATH:$HOME"/android-sdk-linux/platform-tools"(ref: https://askubuntu.com/questions/652936/adding-android-sdk-platform-tools-to-path-downloaded-from-umake)
导出 PATH=$PATH:$HOME"/android-sdk-linux/platform-tools"(参考:https: //askubuntu.com/questions/652936/adding-android-sdk-platform-tools-to-path-downloaded -来自乌马克)
Restart the android studio
重启安卓工作室