gaRos
gaRos

Reputation: 2763

LibGDX and Java 8 source compatibilty

I have a libGDX(1.9.2) project with a Core project with Java 7 compliance settings and an Android project with Java 6 compliance settings in Eclipse projects.

That works great, BUT if I change the compliance settings of the Core project to Java 8, the Android build fails with the following exception:

Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)

I tried to modify the build.gradle of the Core and the Android project but nothing fixed the problem so far.

I understand that the Android requires Java 6, but if the Core project built with Java 7 there is no problem.

Is libGDX compatible with Java 8 and if it is then how can I make it work?

Upvotes: 1

Views: 1694

Answers (1)

Saeed Masoumi
Saeed Masoumi

Reputation: 8916

With android N release you can enable jack & jill to use java 8 features, but if you don't want to use jack & jill, you can use retrolambda to have lambda expressions, method references and try-with-resources statements.

Both of these ways allow you to set your source compatibility to java 1.8, so you can build your project without any problem.

Upvotes: 2

Related Questions