当前位置: 首页 > 知识库问答 >
问题:

合并已存在的dex程序类型时出错:Android.Support.v4.os.ResultReceiver$MyResultReceiver

水睿
2023-03-14
ext {
    anko_version='0.10.5'
    support_lib='1.0.0-alpha1'
    room_lib = "1.1.0"
}
dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation "androidx.cardview:cardview:$support_lib"
    implementation "com.google.android.material:material:$support_lib"
    implementation "androidx.appcompat:appcompat:$support_lib"
    implementation "org.jetbrains.anko:anko:$anko_version"
    implementation "androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1"
    implementation "android.arch.persistence.room:runtime:$room_lib"
    annotationProcessor "android.arch.persistence.room:compiler:$room_lib"
}

误差

>

  • 错误:任务“:app:TransformDexArchiveWithExternAllibsDexMergerForDebug”执行失败。

    com.android.builder.dexing.dexArchivEmergerException:合并dex归档时出错:/app/build/intermediates/transforms/dexbuilder/debug/0.jar,程序类型已存在:Android.support.v4.os.resultReceiver$1

  • 共有1个答案

    秦宁
    2023-03-14

    因为你把依赖关系搞砸了。您必须完全迁移到AndroidX依赖项,或者继续使用支持库依赖项。因此,而不是

    implementation "android.arch.persistence.room:runtime:$room_lib"
    annotationProcessor "android.arch.persistence.room:compiler:$room_lib"
    

    使用

    implementation "androidx.room:room-runtime:2.0.0-alpha1"
    annotationProcessor "androidx.room:room-compiler:2.0.0-alpha1"
    

    还要确保检查gradle.properties项目文件以包含

    android.useAndroidX=true
    android.enableJetifier=true
    
     类似资料: