關於 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.java

 

解決辦法:
A:存在依賴包衝突;(找到並刪掉;通常狀況若是主項目 和 依賴項目中 都有的話;棄掉主項目 中的那個。)
B:嘗試Clean 一下項目;android

C.gradle

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}
相關文章
相關標籤/搜索