关于 Error:Error converting bytecode to dex 异常

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.

解决办法:
A:存在依赖包冲突;(找到并删掉;一般情况如果主项目 和 依赖项目中 都有的话;弃掉主项目 中的那个。)
B:尝试Clean 一下项目;

C.

android {
   defaultConfig {
        ...        
        jackOptions {
            enabled true
        }
    }
    dexOptions {
        incremental true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

  

原文地址:https://www.cnblogs.com/kevin-chen/p/7026731.html