7

I'm getting the following errors when attempting to build a project using JDK 1.8 and eclipse neon:

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:

[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/BuildConfig.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/MainActivity.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$attr.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$dimen.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$id.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$layout.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$menu.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$mipmap.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$string.class

[2016-07-03 02:40:59 - Test1] Dx 
PARSE ERROR:
[2016-07-03 02:40:59 - Test1] Dx unsupported class file version 52.0
...while parsing com/example/test1/R$style.class

[2016-07-03 02:40:59 - Test1] Dx 11 errors; aborting
[2016-07-03 02:40:59 - Test1] Conversion to Dalvik format failed with error 1

Which project settings do I need to change to fix them?

samgak
  • 23,944
  • 4
  • 60
  • 82
anand kumar
  • 121
  • 1
  • 3
  • 9
  • He is asking how to resolve the errors, dear LaurentY. – TomeeNS Jul 12 '16 at 17:10
  • 4
    Go to Menu->Window->Preferences->Java->Compiler, then change option "Compiler compliance level" to 1.7. Save the settings, close Preferences, and try to Run your Project now. – TomeeNS Jul 12 '16 at 17:19

1 Answers1

22

You have to tell your java compiler to produce java 7 compatible class files, because android (dex) does not support java 8 at the moment.

If you want to use lambdas in your sources, you can use retrolambda (https://github.com/evant/gradle-retrolambda) or the new Jack compiler (https://developer.android.com/preview/j8-jack.html)

Update: Since Android Studio 3.0 and Android Gradle Plugin 3.0, java 8 classfiles can be used, too.

larsgrefer
  • 2,735
  • 19
  • 36
  • 2
    This pointed me into the correct direction. Trying out Android in eclipse I had to downgrade the compiler version and jre version to 1.7 and then I no longer got this issue. Just a bit more info: I never saw any logs any error for a long time and always wondered why the Android emulator did not show me my hello world project. Only when I changed the build settings to also generate the .apk (Uncheck option "Skip packaging and dexing until export or launch") I started getting these console logs for Android. Maybe this helps someone. – Ninca Jul 13 '16 at 11:51