Solution :
I was going through some of the interesting questions on this forum and I came across your question.
It is very common error for the programmers who are new to Android and Ionic.
I guess you might have forgotten to set the class paths properly.
Please set the paths as shown below they are same for Ubantu and Mac
export ANDROID_HOME=/Users/mphil/Software/android-sdk-macosx
export PATH=${PATH}:/Users/mphil/Software/android-sdk-macosx/tools
export PATH=${PATH}:/Users/mphil/Software/android-sdk-macosx/platform-tools
After setting up the environment variables you must reload the environment variables using below commands
//For your ubuntu
$source .bashrc
//For your macos
$source .bash_profile
Now you can check in your terminal using below commands
$printenv ANDROID_HOME
$printenv PATH
If you do not see your changes in printenv then try to restart your pc and run above commands again.
Now open the terminal and write $and and try to hit the tab if you see the complete $android then your installation is properly done.
Now you will not face above error.