1

I know this problem appeared recently on stackoverflow, but I still haven't solved my problem after reading and implementing changes sugested in those questions: 1. Unable to Merge Dex - Android Studio 3.0 2. Android Studio 3.0 Execution failed for task: unable to merge dex 3. Android Studio 3.0 Unable to merge dex 4. Unable to merge dex

Getting to the point: Yesterday (2-11-2017) everything worked perfectly fine, but today I got this error:Error:java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

  • I deleted my build forder, rebuilt it etc. etc.
  • I updated Android Studio
  • I invalidated cashes / restarted Android Studio.

Below I put both build.gradle files and full error message. Hope someone can help me solve this problem.

Great thansk for any help you can provide!

Full error message:

Error:java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Error:com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

App Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.radzik.recipes"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile('com.mikepenz:materialdrawer:5.2.0@aar') {
        transitive = true
    }

compile(name: 'toolkit', ext: 'aar')

compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.android.gms:play-services:11.4.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.jakewharton:butterknife:8.7.0'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'

compile 'com.github.barteksc:android-pdf-viewer:1.6.0'
compile 'org.apache.commons:commons-io:1.3.2'

compile 'com.jmedeisis:draglinearlayout:1.1.0'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.android.support:design:25.3.1'
compile 'com.itextpdf:itext-pdfa:5.5.10'
compile 'com.itextpdf:itextg:5.5.9'
compile 'com.mikepenz:google-material-typeface:2.2.0.1@aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mikepenz:itemanimators:0.2.4@aar'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

Project Gradle:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.0'

    }
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
        maven {
            url "https://maven.google.com"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Radzik
  • 244
  • 2
  • 16

0 Answers0