Error-Failed to find 'ANDROID_HOME' environment variable


#1

When I try to build the app from the terminal using the command ‘sudo ionic build android’, then i got the following error. I have installed android sdk and set the ‘ANDROID_HOME’ environmental variable.
can you plz help me???
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.

when I echo the environmental variable i got the following output

jibin@jibin-System-Product-Name:~/ionic/doohdapp$ echo $ANDROID_HOME
/usr/local/android-sdk-linux/
jibin@jibin-System-Product-Name:~/ionic/doohdapp$ echo $PATH
/home/jibin/.local/share/umake/bin:/home/jibin/bin:/home/jibin/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/android-sdk-linux//tools:/usr/local/android-sdk-linux/tools/:/usr/local/android-sdk-linux/platform-tools/:/usr/local/android-sdk-linux/tools/:/usr/local/android-sdk-linux/platform-tools/
jibin@jibin-System-Product-Name:~/ionic/doohdapp$


#2

Did you added the ANDROID_HOME variable to your user-variables or to your system-variables?
In my case i added it first to my user-variables which did not work, and then added it to my system-variables instead which works