【问题标题】:How would I solve an error converting bytecode in Ionic 3我将如何解决在 Ionic 3 中转换字节码的错误
【发布时间】:2019-03-25 12:38:41
【问题描述】:

我发现使用 ionic 3 时出现问题,我尝试运行“ionic cordova run android”但出现错误,这是我得到的错误:

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.
    UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
Error: cmd: Command failed with exit code 1 Error output:(Main.java:775)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
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.
    UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes

这是我的离子信息: geMpF.png

谁能帮我解决这个问题。

谢谢。

【问题讨论】:

  • 能否将java --versiongradle --version的结果相加
  • @christoandrew 我的 JDK 版本是 1.8.0_73,我的 gradle 版本是 2.2.0

标签: ionic-framework ionic3


【解决方案1】:

尝试在您的gradel文件中添加dexOptions并更改compileOptions

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"


    dexOptions {
        incremental true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

【讨论】:

    猜你喜欢
    • 2019-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-19
    相关资源
    最近更新 更多