Reputation: 41
I'm trying to configure Firebase core, firestore, auth, and firebase messaging.
I've updated all version numbers. There error comes when I include firestore and firebase core (all other dependencies/combinations work).
error:
AGPBI: {"kind":"error","text":"Program type already present: com.google.api.AuthProviderOrBuilder","sources":[{}],"tool":"D8"}
Task :app:buildInfoGeneratorDebug FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: com.google.api.AuthProviderOrBuilder
app gradle (edited):
android {
compileSdkVersion 28
defaultConfig {
applicationId "..."
minSdkVersion 19
targetSdkVersion 28
versionCode 65
versionName "1.5.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
{...}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/proguard/androidx-annotations.pro'
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
def fcm_version = '17.3.4'
def firebase_version = '16.0.6'
def parse_version = '1.18.5'
def parse_facebook_version = '1.12.0'
def paypal_version = '2.16.0'
def permissions_version = '1.2.0'
def play_version = '16.0.0'
def work_version = '1.0.0-alpha09'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// support libraries
// play services
implementation "com.google.android.gms:play-services-location:$play_version"
implementation "com.google.android.gms:play-services-places:$play_version"
// Push notifications
implementation "com.google.firebase:firebase-messaging:17.3.4'
implementation "com.google.firebase:firebase-core:16.0.6'
// Crash Logging
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true
}
testImplementation 'junit:junit:4.12'
androidTestImplementation "com.android.support.test:runner:$test_runner_version"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.70'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
}
apply plugin: 'com.google.gms.google-services'
and project gradle:
buildscript {
ext.kotlin_version = '1.2.70'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://clojars.org/repo/"}
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 2
Views: 748
Reputation: 107
I ran into what could potentially be the same issue and finally solved it.
From looking into the dependencies, I found that I had multiple version of protobuf and found that excluding all instances of protobuf-lite, solved my issue.
I added the following to my app gradle file:
configurations.all {
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
}
Hopefully this helps you as much as it did me.
Upvotes: 1