我在 执行 gradle assembleRelease
进行打包apk时爆出了以下错误:
Dex: 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
项目当中没有使用java 1.8 的特性呀, 但是我机器上面安装的JDK 是 1.8 的
PS D:\MainNewMonitorZky\app> java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
PS D:\MainNewMonitorZky\app>
各种google baidu 没有效果呀! 有人遇到过吗?
在 File->Project Structure->Modules 中的 Properties 选项卡,把 Source Compatibility 和 Target Compatibility 都改成 1.7 试试。