程序类型已存在:Google Services Auth
Program type already present: Google Services Auth
我已经遇到这个问题几个星期了,但我似乎找不到任何解决方案。
我的应用程序运行良好但突然停止,并且在我的提交历史记录中看不到任何更改,所以希望有人可以帮助我解决这个问题。
我能够在没有任何错误的情况下构建项目,但是当我尝试在我的 phone 或模拟器中 运行 它时,它不会输出此错误:
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 app:dependencies
但它没有列出我的依赖项。
我已经尝试更改我的依赖项的版本,以查看它是否有效,但它没有。我还尝试用最新版本更新 google-services.json 文件,但这似乎也无济于事。
希望有人能帮我解决这个问题。
我终于找到了解决方案,似乎是 YouTube 依赖项导致了错误。
我通过删除 gradle:
中的这一行来修复错误
implementation('com.google.apis:google-api-services-youtube:v3-rev193-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
我已经遇到这个问题几个星期了,但我似乎找不到任何解决方案。
我的应用程序运行良好但突然停止,并且在我的提交历史记录中看不到任何更改,所以希望有人可以帮助我解决这个问题。
我能够在没有任何错误的情况下构建项目,但是当我尝试在我的 phone 或模拟器中 运行 它时,它不会输出此错误:
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 app:dependencies 但它没有列出我的依赖项。
我已经尝试更改我的依赖项的版本,以查看它是否有效,但它没有。我还尝试用最新版本更新 google-services.json 文件,但这似乎也无济于事。 希望有人能帮我解决这个问题。
我终于找到了解决方案,似乎是 YouTube 依赖项导致了错误。 我通过删除 gradle:
中的这一行来修复错误implementation('com.google.apis:google-api-services-youtube:v3-rev193-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}