【问题标题】:NativeScript ANDROID_HOME missingNativeScript ANDROID_HOME 缺失
【发布时间】:2017-08-26 16:53:44
【问题描述】:

当我运行 tns run androidtns doctor 时,我收到一个错误,即未设置 ANDROID_HOME 环境变量。然而,它是明确设置的。 Mac OSX Sierra 10.12.3。

bash-3.2$ tns run android
The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
bash-3.2$ $ANDROID_HOME
bash: /Users/rlangton/Library/Android/sdk: is a directory
bash-3.2$

【问题讨论】:

标签: android macos nativescript


【解决方案1】:

像这样打开/创建.profile

vim ~/.profile

将以下行添加到.profile 文件的末尾。

export ANDROID_HOME=${HOME}/Library/Android/sdk

使用命令加载配置文件

source ~/.profile

我猜你应该让它工作。这就是我所做的配置。

【讨论】:

  • 我正在使用 Windows,我也遇到了一些相同的错误 The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android. 你能告诉我该怎么做吗?
  • @ClimbTree 请尝试编辑环境变量并添加一个变量ANDROID_HOME ,其值为sdk文件夹的路径。
【解决方案2】:

如果您使用的是 bash,那么您需要更新 ~/.bash_profile 文件。 就我而言,我使用的是 ZSH,所以我需要编辑 ~/.zshrc 文件。

nano ~/.zshrc

在下面添加导出行:

if [ -f /Users/{myusername}/.tnsrc ]; then
    source /Users/{myusername}/.tnsrc
    export ANDROID_HOME=/Users/{myusername}/Library/Android/sdk
fi

Ctrl + O 保存,Ctrl + X 退出。重启终端。现在echo $ANDROID_HOME 每次都显示正确的路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-12
    • 1970-01-01
    • 1970-01-01
    • 2019-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多