Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually
<p>I am trying to build an ionic project. I have set up environment for ionic and android in ubuntu. But don't know why the following error is showing on terminal ... </p>

<pre><code>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.
</code></pre>

<p>I have set up android home as followings ...</p>

<pre><code>userPC:/codes/myApp$ export ANDROID_HOME=/opt/android-sdk-linux
userPC:/codes/myApp$ export ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform_tools
userPC:/codes/myApp$ export ANDROID_TOOLS=/opt/android-sdk-linux/tools
userPC:/codes/myApp$ PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
</code></pre>

<p>my android-sdk-linux is in /opt/ itself. From terminal I can run <strong>android</strong> command. So, I think environment variable is not the main issue. While I am trying to build ionic project, it shows <code>Failed to find 'ANDROID_HOME' environment variable.</code> I am using Android SDK Build Tools 22 and ionic latest version.</p>

<p>Can anyone tell me how can I solve this issue? I have searches a lot but everywhere I found to setup android sdk and environment variable path correctly. But I already have set up all these things. Thanks!</p>