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

前端 未结 26 2991
伪装坚强ぢ
伪装坚强ぢ 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:57

    Finally, I solved it modifiying these attributes on the module gradle file

    1. compileSdkVersion 25
    2. targetSdkVersion 25
    3. compile 'com.android.support:appcompat-v7:+'
    4. compile 'com.android.support:recyclerview-v7:+'
    0 讨论(0)
  • 2020-11-22 02:58

    I solved similar error by adding following piece of code to my build.gradle file inside the android block.

    android {
        dexOptions {
            preDexLibraries = false
        }
    }
    
    0 讨论(0)
  • 2020-11-22 02:59

    In my case the problem was caused by version inconsistency:

    Build tools 25
    compileSdk 24
    targetSdk 24
    Support library 24
    

    The solution was simple: Make everything version 25

    0 讨论(0)
  • 2020-11-22 02:59

    I've had the same issue. In my project, I had the following dependencies :

    • appcompat-v7
    • android-support-v13

    For legacy reasons, the appcompat was fetched from the Google Maven repo, whereas the android-support was a local .jar.

    When I figured out this, and replaced this local reference with a maven reference, it just solved my build issue.

    Here's the diff of my app/build.gradle :

    0 讨论(0)
  • 2020-11-22 03:01

    Got it working for a compile file('...') conflict by increasing minSdkVersion to 21 and enabling multidex. Not sure if that is the best solution but the only way I could get it working in my case.

    Note: for compile file('...') it appears that you cannot put in an exclude clause so that option was not available.

    0 讨论(0)
  • 2020-11-22 03:03

    I had the same problem and it seems that my app had too many methods because of the libraries: http://developer.android.com/tools/building/multidex.html

    Solved it with:

    android {
       defaultConfig {
       ...
       multiDexEnabled = true
       }
    }
    

    More here Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2

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