Android Studio 2.1 Error converting bytecode to dex

后端 未结 3 1016
谎友^
谎友^ 2020-12-15 11:29

I am getting the following error since I updated the android studio from 2.0 to 2.1.

Error:Error converting bytecode to dex:

Cause: Dex ca

相关标签:
3条回答
  • 2020-12-15 11:36

    Possibile duplicate of Android: Dex cannot parse version 52 byte code. The most quoted answer solved the problem for me.
    I added compileOptions and jackOptions as shown below to my build.gradle to use JDK 1.8.

    android {
        ...
        defaultConfig {
            ...        
            jackOptions {
                enabled true
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    0 讨论(0)
  • 2020-12-15 11:40

    Try

    allprojects {
        tasks.withType(JavaCompile) {
            sourceCompatibility = "1.7"
            targetCompatibility = "1.7"
        }
    }
    

    in the main build.gradle file

    0 讨论(0)
  • 2020-12-15 11:46

    Remove the dependencies from build.gradle, comment relevant code and then compile and clean your project.

    After a successful clean add the dependencies again and uncomment what you commented after removing the dependencies earlier.

    0 讨论(0)
提交回复
热议问题