Program type already present: Google Services Auth
Program type already present: Google Services Auth
I've had this problem for several weeks now, and I can't seem to find any solution.
My app worked fine but suddenly it stopped, and can't see any changes in my commit history, so hopefully someone can help me with this.
I'm able to build the project without any errors, but as soon as I try to run it on my phone or in a emulator, it wont and output this error:
Program type already present: com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException
Messagekind=ERROR, text=Program type already present: com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException, sources=[Unknown source file], tool name=Optional.of(D8)
My module gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android
signingConfigs
config
keyAlias 'key'
keyPassword 'keypass'
storePassword 'keypass'
compileSdkVersion 27
flavorDimensions "default"
lintOptions
checkReleaseBuilds false
defaultConfig
applicationId "com.bec.bec"
minSdkVersion 16
targetSdkVersion 27
versionCode 5
versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debug
debuggable true
productFlavors
dev
applicationIdSuffix ".development"
signingConfig signingConfigs.debug
prod
applicationIdSuffix ".production"
signingConfig signingConfigs.config
dataBinding
enabled = true
android.dataBinding.enabled = true
compileOptions
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
configurations.all
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
// SUPPORT
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
// GOOGLE SERVICE
implementation 'com.google.android.gms:play-services-auth:16.0.0'
// DAGGER 2
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
kapt "com.google.dagger:dagger-compiler:2.17"
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.17'
// COMPONENTS
implementation 'android.arch.lifecycle:extensions:1.1.1'
kapt 'android.arch.lifecycle:compiler:1.1.1'
implementation 'android.arch.lifecycle:common-java8:1.1.1'
annotationProcessor 'com.android.databinding:compiler:3.1.4'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
// Retrofit 2
implementation 'com.squareup.okhttp:okhttp:2.2.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
// GSON
implementation 'com.google.code.gson:gson:2.8.2'
// PICASSO
implementation 'com.squareup.picasso:picasso:2.5.2'
// FACEBOOK
implementation 'com.facebook.android:facebook-login:4.35.0'
implementation 'com.facebook.android:facebook-android-sdk:4.28.0'
// FIREBASE
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
// ROOM
implementation 'android.arch.persistence.room:runtime:1.1.1'
kapt 'android.arch.persistence.room:compiler:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
// YOUTUBE
implementation('com.google.api-client:google-api-client-android:1.23.0')
exclude group: 'org.apache.httpcomponents'
implementation('com.google.apis:google-api-services-youtube:v3-rev193-1.23.0')
exclude group: 'org.apache.httpcomponents'
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.1.3'
implementation 'pub.devrel:easypermissions:0.3.0'
// TEST
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// KOTLIN
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
repositories
mavenCentral()
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
Project gradle:
buildscript
ext.kotlin_version = '1.2.61'
repositories
google()
jcenter()
maven
url "https://maven.google.com"
dependencies
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
allprojects
repositories
google()
jcenter()
maven
url "https://maven.google.com"
gradle.projectsEvaluated
tasks.withType(JavaCompile)
options.compilerArgs << "-Xmaxerrs" << "4000"
options.compilerArgs << "-Xmaxwarns" << "4000"
task clean(type: Delete)
delete rootProject.buildDir
What I understand is that, the same dependency is implemented multiple times (maybe I'm wrong?) but I can't see where it comes from.
I've tried using
gradlew app:dependencies
but it does not list my dependencies.
I've tried to change versions of my dependencies, to see if that worked, but it doesn't. I also tried to update the google-services.json file with newest version, but that doesn't seem to help either.
Hope someone can help me solve this issue.
1 Answer
1
I finally found the solution, it seems that the YouTube dependency where causing the error.
I fixed the error by removing this line in my gradle:
implementation('com.google.apis:google-api-services-youtube:v3-rev193-1.23.0')
exclude group: 'org.apache.httpcomponents'
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.