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

前端 未结 26 3055
伪装坚强ぢ
伪装坚强ぢ 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 02:53

    I had the same problem when adding react-native-palette to my project, here is my dependencies tree:

    ./gradlew app:dependencies
    +--- project :react-native-palette
    |    +--- com.facebook.react:react-native:0.20.+ -> 0.44.2
    |    |    +--- javax.inject:javax.inject:1
    |    |    +--- com.android.support:appcompat-v7:23.0.1
    |    |    |    \--- com.android.support:support-v4:23.0.1
    |    |    |         \--- com.android.support:support-annotations:23.0.1 -> 24.2.1
    ...
    |    \--- com.android.support:palette-v7:24.+ -> 24.2.1
    |         +--- com.android.support:support-compat:24.2.1
    |         |    \--- com.android.support:support-annotations:24.2.1
    |         \--- com.android.support:support-core-utils:24.2.1
    |              \--- com.android.support:support-compat:24.2.1 (*)
    +--- com.android.support:appcompat-v7:23.0.1 (*)
    \--- com.facebook.react:react-native:+ -> 0.44.2 (*)
    

    I tried many solutons and could not fix it, until changing the com.android.support:appcompat version in android/app/build.gradle, I wish this can help:

    dependencies {
        compile project(':react-native-palette')
        compile project(':react-native-image-picker')
        compile project(':react-native-camera')
        compile fileTree(dir: "libs", include: ["*.jar"])
        // compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.android.support:appcompat-v7:24.2.1"
        compile "com.facebook.react:react-native:+"
    }
    

    it seems that multiple entries is not a big problem, version mismatch is

提交回复
热议问题