eclipse Dx 不受支持的类文件版本 52.0 ...同时解析 com/example/test1/BuildConfig.class
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38164679/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dx unsupported class file version 52.0 ...while parsing com/example/test1/BuildConfig.class
提问by anand kumar
I'm getting the following errors when attempting to build a project using JDK 1.8 and eclipse neon:
尝试使用 JDK 1.8 和 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?
我需要更改哪些项目设置来修复它们?
回答by larsgrefer
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.
您必须告诉您的 java 编译器生成 java 7 兼容的类文件,因为 android (dex) 目前不支持 java 8。
If you want to use lambdas in your sources, you can use retrolambda (https://github.com/evant/gradle-retrolambda) or the new Hyman compiler (https://developer.android.com/preview/j8-Hyman.html)
如果你想在你的源代码中使用 lambdas,你可以使用 retrolambda ( https://github.com/evant/gradle-retrolambda) 或新的 Hyman 编译器 ( https://developer.android.com/preview/j8-Hyman .html)
Update:Since Android Studio 3.0 and Android Gradle Plugin 3.0, java 8 classfiles can be used, too.
更新:从 Android Studio 3.0 和 Android Gradle Plugin 3.0 开始,也可以使用 java 8 类文件。