android - 无法合并dex Android

标签 android gradle

我收到错误消息无法合并dex,请在stackoverflow上尝试所有操作

buildscript {
    repositories {
        google()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://maven.google.com' }

    flatDir {
        dirs 'libs'
    }
    mavenCentral()
}

def daggerVersion = '2.8'
android {

    compileSdkVersion 28
    buildToolsVersion '27.0.2'
    defaultConfig {
        applicationId "com.upliftapp"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 39
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resConfigs "en"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            // shrinkResources = true
        }
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '26.0.2'
                    //force 'com.android.support:support-v4:27.1.0'
                }
            }
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }
    aaptOptions {
        cruncherEnabled false
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile('com.twitter.sdk.android:twitter:1.14.1@aar') {
        transitive = true;
    }
    compile('com.twitter.sdk.android:tweet-composer:1.0.5@aar') {
        transitive = true;
    }
    compile project(':ViewPagerIndicator-Library')
    compile project(':library_imageloading')
    compile project(':ShortcutBadgerLib')
    compile project(':CircleProgressView')
    compile project(':StickyHeaderLibrary')
    compile project(':VideoLibtoro')
    compile project(':token_textview_library')
    compile project(':swap_lib')
    compile project(':library_parallaxeffect')
    compile project(':curton_library')
    compile project(':fullscreenvideoview')
    compile project(':android-volley-master')
    compile 'com.github.clans:fab:1.6.4'
    compile "com.android.support:appcompat-v7:28.+"
    compile 'com.android.support:design:28.+'
    compile 'com.android.support:cardview-v7:28.+'
    compile 'com.android.support:support-v4:28.+'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.android.support:recyclerview-v7:28.+'
    compile 'com.facebook.fresco:fresco:0.9.0'
    compile 'com.mixpanel.android:mixpanel-android:4.+'
    compile 'com.facebook.android:facebook-android-sdk:4.35.0'
    compile 'com.crittercism:crittercism-android-agent:+'
    compile 'com.google.android.gms:play-services-base:+'
    implementation 'com.google.android.gms:play-services-maps:+'
    implementation 'com.google.android.gms:play-services-appindexing:+'
    compile 'com.orhanobut:logger:1.15'
    compile 'org.java-websocket:Java-WebSocket:1.3.0'
    /*compile 'com.amazonaws:aws-android-sdk-s3:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-ddb:2.2.+'*/

    compile 'com.amazonaws:aws-android-sdk-s3:2.+'
    compile 'com.amazonaws:aws-android-sdk-core:2.+'
    compile 'com.amazonaws:aws-android-sdk-ddb:2.+'

    compile 'com.google.code.gson:gson:2.6.2'
    compile 'net.ypresto.androidtranscoder:android-transcoder:0.1.10'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.instabug.library:instabug:8.0.13'
    compile 'org.jsoup:jsoup:1.8.3'
    compile 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.0'
    compile 'com.github.stfalcon:frescoimageviewer:0.4.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.etsy.android.grid:library:1.+'
    compile 'com.jpeng:LoadingProgress:1.1.0'
    compile 'com.theartofdev:fast-image-loader:0.8.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'in.srain.cube:ultra-ptr:1.0.11'
    testCompile 'junit:junit:4.12'
    compile project(':library_scrollable')
    compile 'io.branch.sdk.android:library:2.+'
    compile 'com.appsflyer:af-android-sdk:4+@aar'
    compile 'com.vdurmont:emoji-java:3.1.3'
    compile project(':bettervideoplayer')
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.okhttp3:okhttp:3.8.0'
    implementation project(':emojify_new')
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'com.github.nkzawa:socket.io-client:0.3.0'
    implementation 'com.wowza.gocoder.sdk.android:com.wowza.gocoder.sdk:2.0@aar'


    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-iid:16.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    compile 'com.google.firebase:firebase-crash:9.4.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'org.greenrobot:eventbus:3.1.1'

    implementation "com.google.dagger:dagger:$daggerVersion"
    annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
}

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

错误日志
错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

最佳答案

您是否尝试过更新图书馆?也删除compile关键字并将其替换为implementation

关于android - 无法合并dex Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56650937/

相关文章:

java - Gradle 下的 JUnit 5 具有多个源集

java - 通过gradle将系统属性传递给cucumber测试

android-studio - 尝试通过Android Studio构建APK时出现此错误

android - SurfaceView/CanvasView 一般问题

android - MPAndroidChart - 添加偏移顶部

android - 总是显示 Smart Lock 多帐户解析

java - Dagger:多次注入(inject)的类中没有可注入(inject)成员

android - 从内部 viewpager fragment 调用 Activity 方法

android - 如何让 runProguard 为 android-library Gradle 插件工作?

Android - 如何在 gradle build 时从 bitbucket 下载文本文件并将其添加到项目中