I had Java 1.7.0_21 installed and I installed 1.7.0_45 today after uninstalling the previous version. Now Android Studio has stopped compiling projects and says that it cant
Go to File>Project Structure>JDK location:
Here, you have to set the directory path exactly same, in which you have installed the java version.
Also, you have to mention the paths of SDK for project run on emulator successfully.
Why This Problem Occurs: It is due to the unsynchronized java version directory that should be available to Android Studio for java code compilance.