Gradle build error Error converting bytecode to dex:Cause: com.android.dex.DexException:Multiple dex files define Landroid/arch/lifecycle/liveData$1

后端 未结 7 1568
轮回少年
轮回少年 2021-01-24 15:23

From last 3 days I\'m getting this error and have tried all i could. Can anyone help me correct it. I\'m using Android 3.0 and my sdk and Google play services are updated as wel

相关标签:
7条回答
  • 2021-01-24 15:44

    This should be related to incompatible versions in your gradle library. can you past your gradle libraries here

    0 讨论(0)
  • 2021-01-24 15:47

    Did you add the dependence in your build.gradle?

    compile 'com.android.support:multidex:1.0.0'
    
    0 讨论(0)
  • 2021-01-24 15:48

    I updated libraries with new version. Need to declare all the android base libraries in the same version(If you update some libraries with new version and using some in older one will cause this kind of exception).

        ext { archLifecycleVersion = '1.1.0'}
    
    dependencies {
    implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"}
    
    0 讨论(0)
  • 2021-01-24 15:53

    Had the same issue, all I had to do was to update all the libraries I was using to their respective new updates and sync the gradle and rebuild and run again This worked for me

    0 讨论(0)
  • 2021-01-24 15:58

    I've just met the same issue and fixed it by updating the version of lifecycle library:

    implementation 'android.arch.lifecycle:runtime:1.1.0'
    implementation 'android.arch.lifecycle:extensions:1.1.0'
    implementation 'android.arch.lifecycle:compiler:1.1.0'
    

    It seems that another library using in my project declare the version 1.1.0, but i was using 1.0.0.

    0 讨论(0)
  • 2021-01-24 16:00

    Try the menu "Invalidate Caches / Restart...", under the File menu.

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