If you can't compile a proyect and you have this message:
Go to File -> Project Structure, then go to Modules section and select your module app and then select a Compile Sdk Version and a Build Tools Version after that click in OK.
Wait until gradle synchronize and ready!