多个 dex 文件定义了 Landroid/arch/lifecycle/LiveData$LifecycleBound



当运行应用程序时,它显示错误

错误:任务执行失败 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 德克斯

build.gradle

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.6.2') {
        transitive = true
    }
    compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.2'
    compile 'com.google.firebase:firebase-auth:11.6.0'
    compile 'com.google.firebase:firebase-messaging:11.6.0'
    compile 'com.google.firebase:firebase-messaging:11.6.0'
    compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'
    compile 'com.github.TheBrownArrow:PermissionManager:1.0.0'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'gun0912.ted:tedbottompicker:1.0.12'
    compile 'com.akexorcist:googledirectionlibrary:1.0.5'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.android.gms:play-services-maps:11.6.0'
    compile 'com.google.android.gms:play-services-location:11.6.0'
    compile 'com.google.android.gms:play-services-places:11.6.0'
    compile 'com.google.android.gms:play-services-base:11.6.0'
    compile 'com.google.firebase:firebase-database:11.6.0'
    compile 'com.google.code.gson:gson:2.8.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'me.anwarshahriar:calligrapher:1.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'uk.co.chrisjenx:calligraphy:2.3.0'
    compile 'com.seatgeek:placesautocomplete:0.3-SNAPSHOT'
    compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation 'com.android.support:cardview-v7:27.0.0'
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support:design:27.0.0'
}

您需要对所有支持依赖项使用相同的版本,并且不要添加重复的依赖项。您需要对依赖项进行分组,以便于管理。您的依赖项应如下所示:

dependencies {
    // Support library
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    // Firebase and Play service library
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    implementation 'com.google.firebase:firebase-messaging:11.6.0'
    implementation 'com.google.android.gms:play-services-maps:11.6.0'
    implementation 'com.google.android.gms:play-services-location:11.6.0'
    implementation 'com.google.android.gms:play-services-places:11.6.0'
    implementation 'com.google.firebase:firebase-database:11.6.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.2'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'
    implementation 'com.github.TheBrownArrow:PermissionManager:1.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'gun0912.ted:tedbottompicker:1.0.12'
    implementation 'com.akexorcist:googledirectionlibrary:1.0.5'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'me.anwarshahriar:calligrapher:1.0'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.seatgeek:placesautocomplete:0.3-SNAPSHOT'
    implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'
    implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
}

最新更新