Gradle build error Error converting bytecode to de

2019-03-02 14:01发布

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 well as i have addedmultiDexEnabled true to my code...and also tried deleting the .gradle and .idea folders and again rebuilding the....but the error is still there any help would be appreciated

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

7条回答
倾城 Initia
2楼-- · 2019-03-02 14:06

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.

查看更多
Ridiculous、
3楼-- · 2019-03-02 14:08

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

查看更多
狗以群分
4楼-- · 2019-03-02 14:11

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

查看更多
Ridiculous、
5楼-- · 2019-03-02 14:17

Did you add the dependence in your build.gradle?

compile 'com.android.support:multidex:1.0.0'
查看更多
趁早两清
6楼-- · 2019-03-02 14:20

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"}
查看更多
▲ chillily
7楼-- · 2019-03-02 14:27

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

查看更多
登录 后发表回答