you can edit the environment variable file in Ubuntu to set android home globally.
[1] run this command in terminal
sudo -H gedit /etc/environment
[2] your envirmnent file content will look like the below one
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
[3] in environment file add android sdk path as follows:-
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
ANDROID_HOME="/home/yourPathTo/Android/Sdk"
[4] then you can check the Android home path in the terminal with the following command:-
echo $ANDROID_HOME
If path is still not set then restart the system to get the applied changes.