Did you uninstall the previous versions?If you did then you will no longer have the build and tools referenced in your gradle.1. Open your SDK manager to see what version you have.2. Open your module level build.gradle.3. Compare the two.

Dear Gary Whitney,I have forgot to mention that I had formatted my laptop and installed the windows 10 and with it the latest android studio and installed it according to the Bucky's videos.So yes, I did uninstalled the previous version.Didn't understood the steps you mentioned.