Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

前端 未结 26 3380
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 02:29

If I run gradle assembleDebug from the command line, I am suddenly getting this error:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexEx         


        
26条回答
  •  野性不改
    2020-11-22 03:06

    I started getting this error when upgrading to ButterKnife 8.5.1. None of the other answers here worked for me.

    I used gradle -q :app:dependencies to see the tree, and then looked through jar files until I found the conflict. The conflict was that butterknife's dependency on com.android.support:support-compat:25.1.0 contains a version of the accessibility class, and com.android.support:support-v4:23.1.1 also contains the class.

    I solved it by changing my dependency from this:

    compile 'com.jakewharton:butterknife:8.5.1'
    

    to this:

    compile('com.jakewharton:butterknife:8.5.1') {
        exclude module: 'support-compat'
    }
    

    It doesn't seem to affect ButterKnife's operation so far.

    Edit: There is a better solution, which was to upgrade my android support libraries to match ButterKnife's:

    compile('com.android.support:appcompat-v7:25.2.0')
    compile('com.android.support:design:25.2.0')
    compile 'com.jakewharton:butterknife:8.5.1'
    

提交回复
热议问题