On trying to run Android Studio 2.2 Preview 1, it gives the following error on gradle build:
Error:Please use JDK 8 or newer.
FAILURE: Build failed with an exception.
- Where: Build file 'C:\Coding\Android projects\MaterialScrollBar\app\build.gradle' line: 1
- What went wrong: A problem occurred evaluating project ':app'.
com/android/jack/api/ConfigNotSupportedException : Unsupported major.minor version 52.0
I ran into this issue with a previous version of Android Studio. When I first installed Android Studio I was able to reference JDK 7 in my Program Files directory.
When I upgraded Android Studio and tried to update it to point to JDK 8, which was also in my Program Files directory, I got the same behavior you are seeing. The new path never took and it still used JDK 7.
Turns out Android Studio does not like spaces in the paths to the Android SDK and the JDK. Installing the JDK in a location that does not contain any spaces allowed me to update the location through the Project Structure window.