Error converting bytecode to dex:Dex cannot parse version 52 byte code
来源:互联网 发布:为什么淘宝助理打不开 编辑:程序博客网 时间:2024/06/06 00:07
前两天使用Dagger2写一个小Demo时,编译正常,但是在安装的时候就报错了,错误如下:
Error:Error converting bytecode to dex:Cause: Dex cannot parse version 52 byte code.This is caused by library dependencies that have been compiled using Java 8 or above.If you are using the 'java' gradle plugin in a library submodule add targetCompatibility = '1.7'sourceCompatibility = '1.7'to that submodule's build.gradle file.
当时就想WTF,编译得时候还是好好的,怎么就出错了呢?当时就引入了Dagger2一个库:
compile 'com.google.dagger:dagger:2.10-rc1'annotationProcessor 'com.google.dagger:dagger-compiler:2.10-rc1'
行吧,你说我引入的library使用的是Java8编译,要更换到Java7,我按你说的来,在gradle文件中添加:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }
这下总该是好了吧,编译运行,还是一样的错误。真是百思不得其解,那就求救大神吧,在StackOverFlow上看到大神说,要添加jack编译器为true(Android N 开始google采用自己的全新的Jack & Jill编译器):
jackOptions{ enable true}
然而,结果还是一样的让人蛋疼。当时想,为什么之前使用Dagger2的时候没有出现这样的错误,试试之前的版本,把daggger的依赖版本改为2.9,编译运行,Perfect!
我猜想,可能是2.10-rc1这个版本采用JAVA8编写的,然而编译的时候采用jack编译器编译的时候,由于某些原因,只能在Java7上运行,当然这只是猜测,有时间得去研究研究编译器的编译原理。
2 0
- java-Android Error:Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code.
- Error converting bytecode to dex:Dex cannot parse version 52 byte code
- Error converting bytecode to dex
- Error converting bytecode to dex
- 关于Error:Error converting bytecode to dex:
- 1.Error:Error converting bytecode to dex:
- Error:Error converting bytecode to dex:
- Error:Error converting bytecode to dex:
- Error:Error converting bytecode to dex:
- 关于Error:Error converting bytecode to dex:
- Error:Error converting bytecode to dex
- AndroidStudio--Error converting bytecode to dex
- AndroidStudio--Error converting bytecode to dex
- gradle : Error converting bytecode to dex
- 解决mysql-connector-java驱动编译时Dex cannot parse version 52 byte code...等错误
- AS报Error:Error converting bytecode to dex:
- recyclerview的“Error:Error converting bytecode to dex“报错
- 关于Error:Error converting bytecode to dex问题解决
- HDU4545 魔法串 字符串处理
- Lcx的多种用法:3个功能+9个参数
- 九大基础排序总结与对比
- 程序员必读书籍排行榜
- java虚拟机垃圾回收的几个特点
- Error converting bytecode to dex:Dex cannot parse version 52 byte code
- Android网络请求框架AsyncHttpClient详解(整理)
- java开发总结
- python环境搭载和安装库文件
- Mysql 查看连接数,状态 最大并发数(赞)
- C# 委托delegate
- Oracle报错之INS-13001
- Android wifi搜索与连接
- 二叉树的创建、层次遍历、递归及非递归先中后序遍历