Got “unsupported class file version 52.0” after including a module to a project

前端 未结 4 759
轻奢々
轻奢々 2020-12-03 21:11

After creating an empty project within Android Studio and including a pure java module, which compiles and works perfectly on its own, I get the following error on every sin

4条回答
  •  无人及你
    2020-12-03 21:15

    I've faced similar errors while building the project.

    Error:PARSE ERROR
    Error:unsupported class file version 52.0
    

    I faced these errors after I've switched from Java 1.8 to Java 1.7. My project consists of several libraries, 1 app module, 3 Android library modules and 2 Java library modules. I didn't change anything in Android libraries, but added the following lines in dependencies of build.gradle files of Java libraries.

    sourceCompatibility = 1.7
    targetCompatibility = 1.7
    

    It solved the problem for me. Parsing error was mainly because the Java 1.8 classes couldn't be parsed into Java 1.7 classes.

提交回复
热议问题