I ran the Android studio as administrator and then it worked as it is a permission issue.
chmod 777 $ANDROID_HOME -R is not a good solution like @spark mentioned.
I solved it by setting ownership to myself
sudo chown $USER:$USER $ANDROID_HOME -R
The permission of my Android directory was set to write only by root so android-studio was unable to write any changes. I changed the permissions to 777 and it fixed the problem.
Thanks for Help anyways.