Tag Archives: Error:Error converting bytecode to dex

Error:Error converting bytecode to dex [How to Solve]

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.

 

Solution:
A: There is a dependency package conflict; (find and delete; in general, if there are both in the main project and the dependent project; discard the one in the main project.)
B: Try to clean the project;

C.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
android {
   defaultConfig {
        ...       
        jackOptions {
            enabled true
        }
    }
    dexOptions {
        incremental true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}