将 SDK 工具添加到 Android Studio 应用中的路径 [英] Add SDK tools to path in Android Studio app

查看:28
本文介绍了将 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

这样我就可以将它们与例如Phonegap.

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.

  1. 通过在终端上发出命令 open ~/.bash_profile 打开你的 ~/.bash_profile 文件

将以下行添加到该文件的末尾

Add the following lines to the end of that file

  1. 导出路径=/Users/$USER/Library/Android/sdk/tools:$PATH
  2. 导出路径=/Users/$USER/Library/Android/sdk/tools/bin:$PATH
  3. 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

    这篇关于将 SDK 工具添加到 Android Studio 应用中的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆