I was testing the Firebase In-App Messaging feature, added the dependency
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
But android studio throws DexArchiveMergerException. I have multi dexing enabled as shown in the below build.gradle.
Here is my 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(project)
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' }
}
}
Here are the errors that I am getting:
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)}
and
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
and
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
Both firebase-firestore
and firebase-inappmessaging-display
contain com.google.a.a.a.a.zza
that is why you get the following error:
Program type already present: com.google.a.a.a.a.zza
Removing implementation 'com.google.firebase:firebase-firestore:17.1.0'
will fix the problem.
This has been finally fixed after Firebase did an update
Now you are able to use firestore and In-AppMessaging in the same project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With