web-dev-qa-db-fra.com

L'ajout d'une dépendance de messagerie In-App Firebase donne une exception DexArchiveMergerException

Je testais la fonctionnalité de messagerie In-App Firebase, a ajouté la dépendance 

implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'

Mais le studio Android lève DexArchiveMergerException. J'ai multi dexing activé comme indiqué dans le build.gradle ci-dessous.

Voici mon build.gradle (app)

apply plugin: 'com.Android.application'
apply plugin: 'kotlin-Android'
apply plugin: 'kotlin-Android-extensions'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
Android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    dexOptions {
        keepRuntimeAnnotatedClasses false
    }

    defaultConfig {
        applicationId "np.com.aawaz.csitentrance"
        minSdkVersion 16
        targetSdkVersion 25
        multiDexEnabled true
        versionCode 80
        versionName "3.1.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.Android.support:design:27.1.1'
    implementation 'com.Android.support:appcompat-v7:27.1.1'
    implementation 'com.Android.support:recyclerview-v7:27.1.1'
    implementation 'com.Android.support:cardview-v7:27.1.1'
    implementation 'com.Android.support:support-v4:27.1.1'
    implementation 'com.Android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.facebook.Android:facebook-Android-sdk:4.34.0'
    implementation 'com.google.Android.gms:play-services-auth:16.0.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.daimajia.easing:library:2.0@aar'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    implementation 'com.daimajia.androidanimations:library:2.2@aar'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.github.medyo:fancybuttons:1.8.4'
    implementation 'gun0912.ted:tedpermission:2.2.0'
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'com.Android.support:multidex:1.0.3'

    implementation 'com.crashlytics.sdk.Android:crashlytics:2.9.4'

    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-firestore:17.1.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-perf:16.1.0'
    implementation 'com.google.firebase:firebase-appindexing:16.0.1'
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
repositories {
    mavenCentral()
}

build.gradle (projet)

buildscript {
    ext.kotlin_version = '1.2.50'
    repositories {
        mavenCentral()
        maven { url "https://jitpack.io" }
        jcenter()
        google()
        maven {
            url 'https://maven.google.com/'
        }
        maven { url 'http://dl.bintray.com/amulyakhare/maven' }
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.Android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        mavenCentral()
        maven { url "https://jitpack.io" }
        jcenter()
        google()
        maven {
            url 'https://maven.google.com/'
        }
        maven { url 'http://dl.bintray.com/amulyakhare/maven' }
        maven { url 'https://maven.fabric.io/public' }
    }
}

Voici les erreurs que je reçois: 

Program type already present: com.google.a.a.a.a.zza
Message{kind=ERROR, text=Program type already present: com.google.a.a.a.a.zza, sources=[Unknown source file], tool name=Optional.of(D8)}

et 

org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.

et

Java.lang.RuntimeException: com.Android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/0, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/1, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/2, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/3, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/5, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/6, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/7, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/8, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/9, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/11, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/12, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/13, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/14, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/15, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/16, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/17, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/18, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/19, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/20, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/21, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/22, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/23, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/24, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/25, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/27, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/28, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/29, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/30, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/31, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/32, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/33, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/34, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/35, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/36, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/37, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/38, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/39, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/40, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/41, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/42, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/44, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/45, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/46, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/47, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/48, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/49, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/50, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/51, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/52, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/53, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/54, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/55, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/56, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/57, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/58, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/59, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/60, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/61, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/62, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/63, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/64, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/65, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/67, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/68, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/69, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/70, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/71, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/72, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/73, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/74, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/75, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/76, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/78, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/79, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/80, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/81, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/82, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/83, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/84, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/86, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/87, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/88, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/89, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/90, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/91, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/94, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/95, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/96, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/97, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/98, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/99, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/100, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/105, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/106, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/107, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/108, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/109, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/110, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/111, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/112, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/120, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/121, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/122, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/123, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/124, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/125, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/126, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/127, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/128, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/129, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/136, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/137, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/138, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/139, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/140, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/141, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/142, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/143, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/144, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/145, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/146, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/147, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/148, /Users/muskan/AndroidStudioProjects/CSIT_Entrance/app/build/intermediates/transforms/dexBuilder/debug/149  
6
Aawaz Gyawali

firebase-firestore et firebase-inappmessaging-display contiennent tous deux com.google.a.a.a.a.zza, c’est pourquoi vous obtenez l’erreur suivante:

Type de programme déjà présent: com.google.a.a.a.a.zza

Supprimer implementation 'com.google.firebase:firebase-firestore:17.1.0' résoudra le problème.

Modifier:

Ce problème a finalement été résolu après la mise à jour de Firebase.

 enter image description here

Vous pouvez maintenant utiliser firestore et In-AppMessaging dans le même projet

4
Peter Haddad
  1. Essayez de changer targetSdkVersion en 27 et minSdkVersion 23

  2. clean 

  3. rebuild

0
Angus Tay