无法合并Dex - Android Studio 3.0,DexIndexOverflowException

时间:2017-11-03 13:25:35

标签: java android android-studio android-gradle

我知道这个问题最近出现在stackoverflow上,但在阅读和实现这些问题中出现的变化后,我仍然没有解决我的问题:  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

指出: 昨天(2-11-2017)一切都很好,但今天我收到了这个错误:Error:java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

  • 我删除了我的build forder,重建了它等等。
  • 我更新了Android Studio
  • 我使兑现无效/重新启动Android Studio。

下面我放了build.gradle文件和完整的错误消息。希望有人能帮我解决这个问题。

您可以提供的任何帮助都很棒!

完整的错误消息:

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
}

0 个答案:

没有答案