Error: Unable to merge Dex

Asked

Viewed 193 times

0

This error started happening when I added the uCrop library.
How to solve?

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
    applicationId "br.vassisn2001.agendaescolar_online"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        multiDexEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'postgresql:postgresql:9.1-901-1.jdbc4'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.android.support:multidex:1.0.2'
implementation ('com.github.yalantis:ucrop:2.2.1', {
    exclude group: 'com.android.support'
})
testImplementation 'junit:junit:4.12'
implementation files('libs/ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar')
}

buildscript {
repositories {
    jcenter()
    mavenCentral()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}
dependencies {
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
    classpath 'com.android.tools.build:gradle:3.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

repositories {
    maven { url 'https://jitpack.io' }
}
}

allprojects {
repositories {
    jcenter()
    mavenCentral()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    maven { url "https://jitpack.io" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
  • Try this: https://answall.com/a/157946/35406 ---> multiDexEnabled inside defaultConfig

  • I had tried before, as it shows in the code, did not give :/

  • Tries to insert, clear/rebuild the project and tries to compile again.

  • I’ve tried too :/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.