Error while merging dex Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

后端 未结 9 1051
梦如初夏
梦如初夏 2020-12-01 03:40

Error when merging the dex

following are the dependencies.

ext {
    anko_version=\'0.10.5\'
    support_lib=\'1.0.0-alpha1\'
    room_lib = \"1.1.0\         


        
相关标签:
9条回答
  • 2020-12-01 03:52

    This is what worked for me was Refactor -> Migrate to AndroidX option in Android Studio. This seemed to resolve any things I may have missed when trying to do the AndroidX migration one dependency at a time. https://developer.android.com/jetpack/androidx/migrate

    0 讨论(0)
  • 2020-12-01 03:58

    I had the same problem.

    Do not mix dependencies styles(androidx and com.android.support) in your project.

    In your code try to replace

    implementation "androidx.appcompat:appcompat:$support_lib"

    with

    implementation "com.android.support:appcompat-v7:$version_of_support_library"

    A full list of dependencies migration you can find here .

    I should use old style dependency because I needed WorkManager and according to official documentation WorkManager currently without AndroidX dependencies.

    WorkManager classes are already in the androidx.work package, but currently depend on Support Library 27.1, and associated Arch component versions. Version of WorkManager with AndroidX dependencies will be released in the future.

    0 讨论(0)
  • 2020-12-01 03:59

    add following lines on gradle.properties

    android.useAndroidX=true
    android.enableJetifier=true
    

    and change your room dependencies on build.gradle(moudel:app)

    implementation "androidx.room:room-runtime:2.0.0-alpha1"
    annotationProcessor "androidx.room:room-compiler:2.0.0-alpha1"
    
    0 讨论(0)
  • 2020-12-01 04:01

    Check the package which clashes with the com.android.support and exclude it from that package. For me, I was using androidx packages and also FCM, where there was a clash. So, this fixed for me:

    implementation ('com.google.firebase:firebase-core:16.0.4') {
        exclude group: 'com.android.support'
    }
    
    0 讨论(0)
  • 2020-12-01 04:02

    for my instance i had upgraded from implementation 'com.github.bumptech.glide:glide:4.0.0 to implementation 'com.github.bumptech.glide:glide:4.7.1'

    0 讨论(0)
  • 2020-12-01 04:04

    Migrate the dependencies to androidx dependencies. And in gradle.properties add the below lines (If not created already, create the file in root folder).

    android.useAndroidX=true
    android.enableJetifier=true
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题