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!


Author: thinkwei


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