有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法在运行应用程序时合并Dex错误

我正在尝试运行我的安卓应用程序。它以前工作得很好。可能是在new updated gradle中运行之后,我发现了这个错误

Error:java.lang.RuntimeException: java.lang.RuntimeException: com.安卓.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:java.lang.RuntimeException: com.安卓.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:com.安卓.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:com.安卓.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/JdkConstants$CursorType;

尝试过清理和重建项目。我每次重建时都会出现以下错误,每次运行时都会出现以下错误

错误:任务“:app:transformClassesWithMultidexlistForDebug”的执行失败

java.io.IOException: Can't write [/PROJECT_LOCATION/app/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/annotations/13.0/annotations-13.0.jar(;;;;;;**.class)] (Duplicate zip entry [annotations-13.0.jar:org/intellij/lang/annotations/Flow.class]))

我的构建渐变配置

compileSdkVersion 26
defaultConfig {
    applicationId "MY_ID"
    minSdkVersion 18
    targetSdkVersion 26
    versionCode 65
    versionName "5.5.38"
    testInstrumentationRunner "安卓.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    renderscriptTargetApi 14
    renderscriptSupportModeEnabled true

    vectorDrawables.useSupportLibrary = true
}

共 (1) 个答案

  1. # 1 楼答案

    根据我的经验dexMerger当模拟器/移动设备中的dex版本无法与新构建的版本无缝融合时,问题往往会发挥作用

    1. 尝试删除移动设备/模拟器上的应用程序。然后重新安装