Could not find environment variable ANDROID_HOME. Try installing it manually

I am trying to build an ion project. I set up the environment for ionic and android in ubuntu. But I don’t know why the following error is displayed on the terminal ...

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. 

I installed android home as below ...

 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 

my android-sdk-linux is located in / opt / itself. From the terminal, I can run the android command. So, I believe that the environment variable is not the main problem. While I am trying to create an ionic project, it shows Failed to find 'ANDROID_HOME' environment variable. I am using the Android SDK Build Tools 22 and the latest ion version.

Can someone tell me how can I solve this problem? I searched a lot, but wherever I found to configure the android sdk path and environment correctly. But I already installed all this. Thank!

+1
android environment-variables cordova ionic-framework
Jan 31 '16 at 4:38
source share
2 answers

I think you are doing everything right, with the exception of the bin part.Add ANDROID_HOME variable in the path and specify the appropriate bin directory as:

 1.export ANDROID_HOME=/path/to/android/SDK 2.export PATH=$PATH:$ANDROID_HOME/bin 

when you issue the studio.sh command on the command line, it looks for the bin directory in a path that contains executables! studio.sh is in this case.

For more information read this.

Hope this was helpful.

+2
Jan 31 '16 at 5:29
source share

After a long search. To make a final solution to this problem
Follow Theses increments and it will fix it correctly

  • Remove the current installation of node and npm and ionic and cordova

  • Install nvm, follow this install nvm ubuntu

  • Install node using nvm, following this install node via nvm

  • Installation of ionic and cordova

    npm install -g cordova ionic

  • Never use root to install node, npm, ionic or cordova

  • Install Android Home

    export ANDROID_HOME=/path/to/android/SDK

    export PATH=$PATH:$ANDROID_HOME/bin

After that its working fine for mine and ion can see the Android SDK home

0
Oct. 15 '16 at 15:47
source share



All Articles