在新的終端窗口中找不到android:command

[英]android: command not found in new terminal window


There is a strange problem for me after i installed the android environment and put the paths like here in this question link

在我安裝了android環境並在這個問題鏈接中放置像這里的路徑后,我有一個奇怪的問題

I write the command:

我寫命令:

$ android

The Android SDK manage opens successfully but when i open a new terminal tab and try to write the same command

Android SDK管理成功打開,但是當我打開一個新的終端選項卡並嘗試編寫相同的命令時

$ android

It returns android: command not found

它返回android:命令未找到

How can i solve this problem ?

我怎么解決這個問題 ?

Thanks

3 个解决方案

#1


The Android SDK manage opens successfully but when i open a new terminal tab and try to write the same command

Android SDK管理成功打開,但是當我打開一個新的終端選項卡並嘗試編寫相同的命令時

This is your issue. Your new instance of terminal won't have the path variable set the same.

這是你的問題。您的新終端實例不會將路徑變量設置為相同。

In your home directory, there should be a file named something like .bash_profile or .profile. Here we will want to either adjust the line that is alreadying exporting the path and append to it (:/path/to/android), or create a new line that does the following:

在您的主目錄中,應該有一個名為.bash_profile或.profile的文件。在這里,我們要么調整導出路徑並附加到它的行(:/ path / to / android),或者創建一個執行以下操作的新行:

export PATH=$PATH:/path/to/android

Now every time you launch a new instance of terminal, that line will be automatically run, and you will have android on your path.

現在,每次啟動一個新的終端實例時,該行將自動運行,並且您將在路徑上安裝android。

#2


Its happen sometimes when You have not set the path or Android_Home variable. But What trick I always do is this. I navigate to the sdk folder then in platform-tools then I right press Shift key and right click of mouse and navigate to the option Open command line here.

當您沒有設置路徑或Android_Home變量時,有時會發生這種情況。但我總是這樣做的訣竅就是這個。我導航到sdk文件夾然后在平台工具中然后我右鍵按住Shift鍵並右鍵單擊鼠標並導航到選項打開命令行。

Now here you can write every command and will do your work. Hopes this will work for you.

現在,您可以編寫每個命令並完成您的工作。希望這對你有用。

#3


After adding the PATH entry to your ~/.profile file as mentioned above, log out and back in. That way your entire session will have android in the path.

如上所述將PATH條目添加到〜/ .profile文件后,注銷並重新登錄。這樣整個會話將在路徑中安裝android。

I would also add platform-tools to your PATH as well. That give you adb.

我還會為你的PATH添加平台工具。那給你adb。

So, add something like this to your ~/.profile:

所以,在你的〜/ .profile中添加這樣的東西:

export PATH=$PATH:path_to_sdk/tools:path_to_sdk/platform-tools

Where you replace "path_to_sdk" in the example with the directory were you extracted the Android SDK (e.g. /usr/local/android-sdk-linux).

如果您將示例中的“path_to_sdk”替換為目錄,則解壓縮Android SDK(例如/ usr / local / android-sdk-linux)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2015/05/13/72ffc43f9cdd44e8edb16e427e5ff4b8.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com