将SDK工具添加到Android Studio应用中的路径
我刚刚安装了Android Studio 0.2.2.我想将SDK工具添加到$PATH
(位于此文件夹中):
I have just installed Android Studio 0.2.2. I want to add the SDK tools to the $PATH
, which are in this folder:
/Applications/Android\ Studio.app/sdk/tools
这样我就可以将它们与电话缺口.
so that I can use them with e.g. Phonegap.
但是将这个文件夹添加到$PATH
之后,它仍然会说:
But after I add this folder to the $PATH
, it still keeps saying:
android:找不到命令
android: command not found
奇怪的是,即使我cd
到该文件夹并键入其名称,我也无法运行该文件夹中的任何可执行文件.
Oddly, I can't run any of the executables in that folder even when I cd
to that folder and type their names.
我在做什么错了?
似乎新版本的Android Studio并未与SDK捆绑在一起.因此,/Applications/Android\ Studio.app/sdk/tools
将不再起作用.
It seems that newer versions of Android Studio don't come bundled with the SDK. So, /Applications/Android\ Studio.app/sdk/tools
will no longer work.
从Android Studio启动SDK Manager之后,我意识到新路径是
/Users/$USER/Library/Android/sdk/tools
.
After launching the SDK Manager from Android Studio, I realized the new path is
/Users/$USER/Library/Android/sdk/tools
.
-
通过在终端上发出命令
open ~/.bash_profile
打开~/.bash_profile
文件
在该文件的末尾添加以下行
Add the following lines to the end of that file
-
export PATH=/Users/$USER/Library/Android/sdk/tools:$PATH
-
export PATH=/Users/$USER/Library/Android/sdk/tools/bin:$PATH
-
export PATH=/Users/$USER/Library/Android/sdk/platform-tools:$PATH
export PATH=/Users/$USER/Library/Android/sdk/tools:$PATH
export PATH=/Users/$USER/Library/Android/sdk/tools/bin:$PATH
export PATH=/Users/$USER/Library/Android/sdk/platform-tools:$PATH
保存并关闭~/.bash_profile
文件
如果要使更改在当前终端上生效,则source ~/.bash_profile
;否则,请关闭并重新打开终端,更改将自动进行
If you want the changes to take action on the current terminal, then source ~/.bash_profile
; otherwise, close and re-open the terminal, and the changes will take place automatically