Press "Enter" to skip to content

Error: Failed to find ‘ANDROID_HOME’ environment variable

When you trying to build android for ionic or cordova in linux(ubuntu) but its showing you an error like this:

ubuntu下,当你使用ionic或者cordova build android 命令编译时,出现如下错误:

[Error: Failed to find ‘ANDROID_HOME’ environment variable.
Try setting setting it manually.
Failed to find ‘android’ command in your ‘PATH’.
Try update your ‘PATH’ to include path to valid SDK directory.]

you can do like this:

你可以通过配置环境变量解决:

echo ‘export ANDROID_HOME=”‘$HOME’/your-android-sdk-dir”‘ >> ~/.bashrc
echo ‘export PATH=”$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools”‘ >> ~/.bashrc
echo ‘export JAVA_CMD=”/usr/lib/jvm/java-7-openjdk-amd64/bin/java”‘ >> ~/.bashrc

reentry your terminal use

然后,关掉你的终端,重新打开使环境变量生效,再输入:

source ~/.bashrc

done,that is ok!

这样就搞定了

打赏 赞(0)
微信
支付宝
微信二维码图片

微信扫描二维码打赏

支付宝二维码图片

支付宝扫描二维码打赏

Be First to Comment

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code