Multiple dex files define Landroid/arch/lifecycle/LiveData$LifecycleBoundObserver;

匿名 (未验证) 提交于 2019-12-03 01:06:02

问题:

when run app it show error

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

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' } 

回答1:

You need to use the same version for all support dependencies and don't add duplicate dependencies. You need to group the dependencies to make it easier to manage. Your dependencies should be something like this:

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;     } } 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!