Unsupported major.minor version 52.0 when renderin

2019-01-03 05:38发布

When I try to render a layout preview in Android Studio I get error:

Unsupported major.minor version 52.0

25条回答
Root(大扎)
2楼-- · 2019-01-03 06:26

This occur due to incompatible java version you are using in android studio and the java version that was used with your imported project. Go to File->Project structure->Change jdk 1.7 to jdk 1.8 .After that Go to File->click on Invalidate cache and Restart. Hope this help..

And change the dependency classpath in gradle file

dependencies { classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
查看更多
Emotional °昔
3楼-- · 2019-01-03 06:27

1、make sure Gradle Gradle JVM Version enter image description here

2、make sure ProjectSettings SDKs Veriosn enter image description here

查看更多
相关推荐>>
4楼-- · 2019-01-03 06:28

I tried to find solution to this problem.I tried most of the solutions mentioned in this thread. However, I am not very sure why this was occurring. Probably a bug in Android Studio. Anyhow, this is what solved the problem:

In Application level build.gradle, removed:

  classpath 'com.android.tools.build:gradle:2.2.0-beta1'

replaced with:

classpath 'com.android.tools.build:gradle:2.0.0'
查看更多
萌系小妹纸
5楼-- · 2019-01-03 06:28

I had to update Java version to JDK 8 at Jenkins->Manage Jenkins->Global Tool Configuration->JDK.

查看更多
Explosion°爆炸
6楼-- · 2019-01-03 06:28

Check your JAVA_HOME to use jdk 1.8

Also check : the parameter in Android Studio in order to change at

File->Other Settings->Default Project Structure->SDKs

查看更多
Juvenile、少年°
7楼-- · 2019-01-03 06:29

Make sure to do a clean build after changing a version of Java. As it turns out Android Studio does some work when you switch the JDK but doesn't clean the workspace and creates confusion ¯\_(ツ)_/¯

查看更多
登录 后发表回答