Unable to merge dex

前端 未结 30 2791
深忆病人
深忆病人 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:46

    In my case, Unfortunately, neither Michel's nor Suragch's solutions worked for me.

    So I solved this issue by doing the following:

    In gradle:3.0 the compile configuration is now deprecated and should be replaced by implementation or api. For more information you can read here You can read the official docs at Gradle Build Tool

    The compile configuration still exists but should not be used as it will not offer the guarantees that the api and implementation configurations provide.

    it's better to use implementation or api rather compile

    just replace compile with implementation, debugCompile with debugImplementation, testCompile with testImplementation and androidtestcompile with androidTestImplementation

    For example: Instead of this

    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.github.bumptech.glide:glide:4.0.0'
    

    use like this

    implementation 'com.android.support:appcompat-v7:26.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.github.bumptech.glide:glide:4.0.0'
    

    After that

    • Delete the .gradle folder inside your project ( Note that, in order to see .gradle, you need to switch to the "Project" view in the navigator on the top left )
    • Delete all the build folders and the gradle cache.
    • From the Build menu, press the Clean Project button.
    • After task completed, press the Rebuild Project button from the Build menu.

    Hope it will helps !

提交回复
热议问题