Your runtime environment is running a different version of Java than your compiler - 52.0 represents Java SE 8
On Linux, type:
sudo update-alternatives --config java
Output will be like:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 auto mode
1 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1 manual mode
Press <enter> to keep the current choice[*], or type selection number:
Select 2
Then compile your project:
./gradlew assembleDebug
This fixed it for me:)
On Windows, you can do it via the Java Control Panel very easily - read more about it here!