Dx unsupported class file version 52.0 ...while parsing com/example/test1/BuildConfig.class [closed]
Asked Answered
D

1

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?

Decuple answered 2/7, 2016 at 21:35 Comment(2)
He is asking how to resolve the errors, dear LaurentY.Tuttifrutti
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.Tuttifrutti
S
23

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.

Smukler answered 2/7, 2016 at 21:43 Comment(1)
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.Chondriosome

© 2022 - 2024 — McMap. All rights reserved.