0

After adding a third party library I got the PARSE ERROR: unsupported class file version 52.0 after including the dependency. I have found similar questions like this one. The solution in the link provide suggest to include in the gradle file the following:

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

The problem is that the dependency is using 1.8. So, I have tried to use 1.8 for the entire project by adding Jack as it is suggested here. However, I am also using Realm that can't be used with java 8 as it is explained here.

Is there any way to use 1.8 only for the dependency I want to include and use 1.7 in the rest of the project?

I am quite new and I don't know if this is possible. I have checked around, but I haven't found anything.

Community
  • 1
  • 1
user274051
  • 325
  • 1
  • 12
  • Try using Retrolambda. It is a Gradle Plugin which can translate Java 8 source code to Java 7 source code, however it can't translate everything, for example static methods in interfaces can't be translated to Java 7, so try Retrolambda - if that works you are in luck - otherwise you can't really fix this issue. Then the only option that is left is to find a Java 7 version of that library or compile the library yourself after migrating it to Java 7 (as long as it is open source). – Xaver Kapeller Dec 28 '16 at 16:12
  • Thanks for the quick answer. I am going to try and see if it works. – user274051 Dec 28 '16 at 16:15
  • @XaverKapeller I have tried to use Retrolambda in a clean project, however, I have not been able to sync the gradle. I got Error:Cannot get property 'destinationDir' on null object. – user274051 Dec 29 '16 at 16:41

0 Answers0