原因:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错

原因:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错,android,dex,Android,Dex,在真实设备上部署应用程序时出现“无法合并索引”错误。我还将我的编译和目标sdk升级到android-p 这是我的应用程序gradle文件 apply plugin: 'com.android.application' apply plugin: 'com.google.firebase.firebase-perf' apply plugin: 'io.fabric' android { compileSdkVersion 'android-28' defaultConfig {

在真实设备上部署应用程序时出现“无法合并索引”错误。我还将我的编译和目标sdk升级到android-p

这是我的应用程序gradle文件

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 'android-28'
    defaultConfig {
        applicationId "com.cofoz.cofoz"
        buildToolsVersion '27.0.3'
        minSdkVersion 17
        targetSdkVersion 'P'
        versionCode 15
        versionName "1.1.5"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    useLibrary 'org.apache.http.legacy'
    dexOptions {
        javaMaxHeapSize "2g"
        preDexLibraries true
        jumboMode true
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), "proguard-rules.pro"
            shrinkResources true
            //Other parameters
            //debuggable false
            //jniDebuggable false
            //renderscriptDebuggable false
            //signingConfig playStoreConfig //Add your own signing config
            //pseudoLocalesEnabled false
            //zipAlignEnabled true

            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // Disables PNG crunching for the release build type.
            crunchPngs false

        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
    buildToolsVersion '28.0.1'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support:support-v13:28.0.0-alpha1'
    implementation 'com.android.support:support-v4:28.0.0-alpha1'
    implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1'
    implementation 'com.android.support:mediarouter-v7:28.0.0-alpha1'
    implementation 'com.android.support:support-compat:28.0.0-alpha1'
    implementation 'com.android.support:support-dynamic-animation:28.0.0-alpha1'
    implementation 'com.android.support:palette-v7:28.0.0-alpha1'
    implementation 'com.android.support:design:28.0.0-alpha1'
    implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1'
    implementation 'com.android.support:customtabs:28.0.0-alpha1'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
    implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.android.material:material:1.0.0-alpha1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    //implementation 'com.android.support:multidex:1.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.github.andremion:counterfab:1.0.1'
    implementation 'com.firebaseui:firebase-ui-auth:4.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-config:16.0.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.1'

    //implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'

    // Required only if Facebook login support is required

    //implementation 'com.facebook.android:facebook-android-sdk:4.27.0'

    //implementation 'com.github.DanielMartinus:Stepper-Touch:0.6'

    //implementation 'com.stone.vega.library:VegaLayoutManager:1.0.6'

    //implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
    implementation 'com.squareup.okhttp:okhttp:2.7.2'

    //implementation 'com.google.code.gson:gson:2.8.2'

    //implementation'com.google.firebase:firebase-invites:15.0.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.airbnb.android:lottie:2.2.5'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'

    //implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'

    //implementation 'com.yarolegovich:lovely-dialog:1.1.0'

    //implementation 'com.github.GrenderG:Toasty:1.2.8'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'

    //implementation'io.salyangoz.updateme:updateme:0.1.0'

    //implementation 'com.wdullaer:materialdatetimepicker:3.5.0'

    //implementation 'com.github.ganfra:material-spinner:2.0.0'

    //implementation 'com.google.android.gms:play-services-identity:15.0.0'

    //implementation 'com.github.thomper:sweet-alert-dialog:v1.4.0'

    // Shimmer

    //implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'

    //implementation 'com.karumi:dexter:4.2.0'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.android.gms:play-services-places:15.0.1'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'

    //implementation 'com.github.medyo:android-about-page:1.2.4'
    implementation 'net.danlew:android.joda:2.9.9.3'

    //implementation 'com.instabug.library:instabug:4.13.1'


    //implementation "android.arch.persistence.room:runtime:1.0.0-beta2"
    implementation 'com.github.freshdesk:freshchat-android:1.4.0'
    implementation 'commons-io:commons-io:2.4'
    implementation('com.github.bumptech.glide:glide:4.7.1') {
        exclude group: "com.android.support"
    }
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

    //implementation('com.twitter.sdk.android:twitter-core:3.2.0@aar') { transitive = true }
}

apply plugin: 'com.google.gms.google-services'
我尝试过很多事情,比如清洁和重建项目等。
我在构建应用程序时没有遇到任何错误,但当我将应用程序部署到实际设备时,只会出现错误。

我在项目中添加Firestore时遇到了相同的问题

确保实现了
multidex
库(我发现您的旧版本已被注释掉):


此外,您还实现了
支持compat
支持-v4
support-v4
已经包含了
support compat
所做的一切,因此您有一个重复的实现。请清理您的依赖项并删除您不需要的任何依赖项。

它不起作用。我还收到了这样一个错误:“程序类型已经存在:android.support.v4.app.INotificationSideChannel$Stub$Proxy消息{kind=error,text=Program类型已经存在:android.support.v4.app.INotificationSideChannel$Stub$Proxy,sources=[未知源文件],tool name=Optional.of(D8)}”,您确实需要更新您的依赖项。API 28支持库现在在
rc02
上,而不是
alpha01
上。并检查依赖项中是否有任何红色下划线。同时检查您的项目级Gradle文件是否存在过时的依赖项。如您所说,已删除该依赖项,但我仍然收到相同的错误。请清理其余的依赖项。请发布异常的完整堆栈跟踪。
implementation 'com.android.support:multidex:1.0.3'