Resolved Problem: Android Studio Error Cant install platform 27 or any other platform

Problem:

Android Studio Cant install platform 27 or any other platform build tools. Gradle build failed.When you click the install option presented, it downloads but fails to install;

Solution:

This usually happens because android studio doesnt have the permission to modify some files in your SDK folder which must be locked and then unlocked for installation to take place.

To resolve this:

run the command below to disable restricted access to your sdk path and all subdirectories, files.
chmod -R 777 /path/to/android sdk

NOTE THAT THIS MEANS ANY USER ON UR SYSTEM INCLUDING:

guests can access ur sdk folder. Shouldn’t be a problem though if ur home folder is still protected.

Now start android studio, then when prompted, install the missing platform again.