Android Studio build error - Multiple dex files define Landroid/support/v4/

前端 未结 11 682
别那么骄傲
别那么骄傲 2020-12-17 08:56

I am unable to build my project in Android Studio. I get the following error:

Error:Android Dex: [RaditazAndroid] Unable to execute DX
Error:Android Dex: [R         


        
相关标签:
11条回答
  • 2020-12-17 09:13

    In my case the problem was in module sdk version. I changed it from 2.2 to 4.4 and the problem was solved.

    0 讨论(0)
  • 2020-12-17 09:15

    Away from Android Studio, I opened the project in finder/workspace and did this:

    1- MyProject folder -> build -> intermediate -> dex-cache -> cache.xml, and deleted all support-v4.jar items.

    2- Also away from Android Studio, Went to every module in my project -> lib folder -> and deleted support-v4.jar as well.

    Then cleaned the project and ran it and it worked thanks god :)

    0 讨论(0)
  • 2020-12-17 09:21

    For anyone who is interested, I solved my own problem. My mistake was that I had pasted android-support-v4.jar and google-play-services.jar in all of my project's module lib folders (my project consists of 3 modules). What I had to do instead was to paste these jars only into my main module's lib folder, and the other modules would automatically reference them.

    0 讨论(0)
  • 2020-12-17 09:26

    For others wondering why this problem still persist even doing all other things suggested, This may help.

    For me problem started when i added Glide library

    dependencies {
      .........
      implementation 'com.github.bumptech.glide:glide:4.8.0'
      .........
    }
    

    and i had added already.

    implementation 'com.android.support:design:26.1.0'
    

    Which was contradicting with Glide support library somewhere.

    Solution: Remove or downgrade your Glide support version.

     implementation 'com.github.bumptech.glide:glide:4.0.0'
    
    0 讨论(0)
  • 2020-12-17 09:27

    Clean and rebuild was all it took for mine to start working.

    0 讨论(0)
  • 2020-12-17 09:28

    I had the same error.

    Removing a library(jtwitter.jar) form my-project/app/libs folder helped me.

    Then cleaned the project and ran it and it worked.

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