adb linux path,Android Debug Bridge(adb)命令行工具存在於$ PATH中,但在linux中找不到“command not found”...

sudo echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/lubuntu/Tools/android-sdk-linux/platform-tools

adb exists in /home/lubuntu/Tools/android-sdk-linux/platform-tools

adb存在於/ home / lubuntu / Tools / android-sdk-linux / platform-tools中

Then I executed adb start-server:

然后我執行了adb start-server:

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

Then sudo adb install test.apk

然后sudo adb安裝test.apk

sudo: adb: command not found

I have added adb in the environment variable $PATH, but sudo couldn't find it. Why?

我在環境變量$ PATH中添加了adb,但是sudo找不到它。為什么?

5 个解决方案

#1

6

sudo means you're switching to root, and that does not necessarily mean that your environment comes along. That could be dangerous.

sudo意味着你要切換到root,這並不一定意味着你的環境出現了。那可能很危險。

At your risk, add the -E option to inherit the calling environment.

冒風險,添加-E選項以繼承調用環境。

#2

5

The problem is the PATH var is set for that user, and root don't have the aditional PATH entry, so it can't found the program.

問題是為該用戶設置了PATH var,而root沒有aditional PATH條目,因此無法找到該程序。

You should setup adb for root too:

你也應該為root設置adb:

adb Environmental Variables

adb環境變量

Open ~/.bashrc and add the following to the very bottom

打開〜/ .bashrc並將以下內容添加到最底層

export PATH=${PATH}:/tools:/platform-tools

Change to the actual path. ie /home/user/android-sdk-linux Close and re-open your terminal to refresh variables.

更改為實際路徑。 ie / home / user / android-sdk-linux關閉並重新打開終端刷新變量。

來自adb設置

If doesn't work, make symbolic links from adb and other binaries to /usr/local/bin

如果不起作用,請將adb和其他二進制文件的符號鏈接創建到/ usr / local / bin

#3

2

Since you are running adb as root in the second example, adb would also have to be on root's path.

由於您在第二個示例中以root身份運行adb,因此adb也必須位於root的路徑上。

#4

2

completely agree with answer of @unwind.

You must not do this using "sudo".

Give it a try without sudo and i guess it would work for you.

Also, you should add the path to folder named "tools" present in the sdk, though its not connected with your problem, but a suggestion.

完全贊同@unwind的回答。你不能使用“sudo”這樣做。嘗試沒有sudo嘗試,我想它會對你有用。此外,您應該將路徑添加到sdk中存在的名為“tools”的文件夾中,盡管它與您的問題無關,但建議。

#5

2

Completely agree.

The problem was the Android Debug Bridge (adb) command line tool that was not linked to the path. After setting it in the path, it worked for me.

問題是沒有鏈接到路徑的Android Debug Bridge(adb)命令行工具。在路徑中設置后,它對我有用。

$ gedit ~/.bashrc

set the path as follows in the .bashrc

在.bashrc中設置如下路徑

export PATH=${PATH}:~/adt-bundle/tools

export PATH=${PATH}:~/adt-bundle/platform-tools

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值