Unable to merge dex

前端 未结 30 2746
深忆病人
深忆病人 2020-11-21 22:14

I have Android Studio Beta. I created a new project with compile my old modules but when I tried launching the app it did not launch with the message:

Error:         


        
相关标签:
30条回答
  • 2020-11-21 22:48

    This may not be your problem, but I got this error when I accidentally included two identical (but differently named) libraries in the dependencies{} section of the project.

    0 讨论(0)
  • 2020-11-21 22:49

    Just to add to the above solutions:

    Make sure that you don't have duplicate dependencies pointing to different versions of them, in multiple places (or even in the same file).

    0 讨论(0)
  • 2020-11-21 22:51

    I agree with Chris-Jr. If you are using Firebase to embed your AdMob ads (or even if you are not) the play-services-analytics includes the play-services-ads even though you don't add that as a dependency. Google have obviously made a mistake in their 11.4.0 roll-out as the analytics is including version 10.0.1 of ads, not 11.4.0 (the mouse over hint in the gradle shows this).

    I manually added compile 'com.google.android.gms:play-services-ads:11.4.0' at the top which worked, but only after I disabled Instant Run: http://stackoverflow.com/a/35169716/530047

    So its either regress to 10.0.1 or add the ads and disable Instant Run. That's what I found if it helps any.

    0 讨论(0)
  • 2020-11-21 22:52

    Installing Google play services (latest version) + including

    android {
        defaultConfig {
            multiDexEnabled true
            }
    }
    

    in build.gradle solved the issue for me, make sure to clean and rebuild project!

    0 讨论(0)
  • 2020-11-21 22:53

    I tried all the above and none of them helps. finally, I find this work for me:

    app/build.gradle:

    android {
        defaultConfig {
           multiDexEnabled true
        }
    }
    
    0 讨论(0)
  • 2020-11-21 22:54

    With Android Studio 3.0 stable build Below steps worked for me:

    1. Got to SdkManager-->Android Sdk --> Sdk Tools and Update Google play services to latest version to 46.
    2. Clean project and rebuild project.
    0 讨论(0)
提交回复
热议问题