Unable to merge dex

前端 未结 30 2658
深忆病人
深忆病人 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 23:01

    In my case issue was because of the room library:

    compile 'android.arch.persistence.room:runtime:1.0.0-alpha1'
    

    Changing it to:

    compile 'android.arch.persistence.room:runtime:1.0.0'
    

    worked.

    0 讨论(0)
  • 2020-11-21 23:03

    add commands below:

    android {
    ...
    
        dexOptions {
    
            jumboMode true
            javaMaxHeapSize "4g"
    
        }
    }
    
    0 讨论(0)
  • 2020-11-21 23:03

    One of possible root causes: duplicate transient dependencies that weren't properly handled by Android Studio import of multi-module projects. Check your list and remove them. For me, the fix was literally this:

    --- a/project/module/build.gradle
    +++ b/project/module/build.gradle
    @@ -21,5 +21,4 @@ android {
     dependencies {
         implementation project(':upstream-dependency-project')
         implementation 'com.android.support:support-v4:18.0.0'
    -    implementation files('libs/slf4j-android-1.6.1-RC1.jar')
     }
    
    0 讨论(0)
  • 2020-11-21 23:03
    android {
        defaultConfig {
            ...
            minSdkVersion 15 
            targetSdkVersion 26
            multiDexEnabled true
        }
        ...
    }
    
    dependencies {
      compile 'com.android.support:multidex:1.0.1'
    }
    
    0 讨论(0)
  • 2020-11-21 23:04

    If this error appeared for you after including kotlin support, and none of the other solutions work, try changing the kotlin dependency of app module's build.gradle to:

    implementation ("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version") {
        exclude group: 'org.jetbrains', module: 'annotations'
    }
    

    This works for me on Android Studio 3.0 Beta 6. See this answer for further explanation.

    0 讨论(0)
  • 2020-11-21 23:04

    I also had the problem.

    I was able to solve by changing compileSdkVersion and targetSdkVersion to latest version.

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