Тип программы уже присутствует: Google Services Auth

У меня была эта проблема в течение нескольких недель, и я не могу найти никакого решения.

Мое приложение работало нормально, но внезапно оно прекратилось и не может видеть никаких изменений в моей истории коммитов, так что, надеюсь, кто-то может помочь мне с этим.

Я могу построить проект без каких-либо ошибок, но как только я пытаюсь запустить его на своем телефоне или в эмуляторе, он не выдает эту ошибку:

Program type already present: com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException
Message{kind=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)}

Мой модуль 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'

Проект 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
    }

Я понимаю, что одна и та же зависимость реализуется несколько раз (может быть, я ошибаюсь?), Но я не вижу, откуда она взялась. Я попытался использовать приложение gradlew: зависимости, но оно не перечисляет мои зависимости.

Я пытался изменить версии своих зависимостей, чтобы увидеть, работает ли это, но это не так. Я также пытался обновить файл google-services.json до последней версии, но, похоже, это тоже не помогло. Надеюсь, что кто-то может помочь мне решить эту проблему.

1 ответ

Решение

Я наконец-то нашел решение, похоже, что зависимость YouTube была причиной ошибки. Я исправил ошибку, удалив эту строку в моем Gradle:

implementation('com.google.apis:google-api-services-youtube:v3-rev193-1.23.0') {
    exclude group: 'org.apache.httpcomponents'
}
Другие вопросы по тегам