Problem after updating android studio

I just tried updating Android Studio from version 1.4 to 2.2 2. After updating Android Studio, when I tried to open it, it showed me this error:

Error: (1, 1) There was a problem evaluating the project ': app'.

java.lang.UnsupportedClassVersionError: com / android / build / gradle / AppPlugin: Unsupported version of major.minor 52.0

enter image description here

Can someone help me resolve this?

+7
android studio
source share
2 answers

I spent quite a lot of time with this in Android Studio too.

This problem seems to be caused by the difference in the java version used to compile the project.

Finally, in the "Project Structure" settings window, I turned on "Use the built-in JDK (recommended)" on the "SDK Location" tab.

And a happy compilation :)

+11
source share

Your runtime runs a different version of Java than your compiler - 52.0 introduces Java SE 8

On Linux, type:

sudo update-alternatives --config java 

The output will look like this:

 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: 

Choose 2

Then compile your project:

 ./gradlew assembleDebug 

This is fixed for me :)

On Windows, you can easily do this using the Java Control Panel - more on that here !

+2
source share

All Articles