Android 无法合并dex-当我使用Facebook观众网络SDK时

Android 无法合并dex-当我使用Facebook观众网络SDK时,android,facebook,gradle,android-multidex,Android,Facebook,Gradle,Android Multidex,我在使用Facebook观众网络SDK时遇到此错误 错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败。java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex 我的应用程序级别渐变 apply plugin: 'com.android.application' apply plugi

我在使用Facebook观众网络SDK时遇到此错误

错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败。java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex

我的应用程序级别渐变

    apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.xyz.abc"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 8
        versionName "1.1"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }

    dexOptions {
        incremental = true;
        preDexLibraries = false
        javaMaxHeapSize "4g"
        jumboMode true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }

    implementation 'com.android.support:multidex:1.0.2'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:support-vector-drawable:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    implementation 'com.github.bumptech.glide:glide:4.4.0'

    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    implementation 'com.android.volley:volley:1.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'


    implementation 'com.google.android.gms:play-services-base:11.8.0'
    implementation 'com.google.android.gms:play-services-ads:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation 'com.google.android.gms:play-services-auth:11.8.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.6.0'

    implementation 'me.wangyuwei:ParticleView:1.0.4'
    implementation 'com.devbrackets.android:exomedia:4.0.3'
    implementation 'com.facebook.android:audience-network-sdk:4.27.0'

    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我的主人格雷德尔长得很像

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.1'
        classpath 'io.fabric.tools:gradle:1.+'

    }
}

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Facebook观众网络已经包含了一个exoplayer的副本

替换

implementation 'com.facebook.android:audience-network-sdk:4.27.0'


它应该可以工作。

以前可以工作,但在本例中不起作用:
implementation'com.facebook.android:facebook-android-sdk:4.37.0'实现('com.facebook.android:academy-network-sdk:5.1.0'){exclude group:'com.google.android.exoplayer'}
Hi@Gurjapsingh,是的,它确实起作用了。这个问题与我的项目有关,我确实重新创建了它,并且它像以前一样工作。
implementation ('com.facebook.android:audience-network-sdk:4.27.0'){
    exclude group: 'com.google.android.exoplayer'
}