gpt4 book ai didi

android - 在模块guava-26.0-android.jar和guava-jdk5-17.0.jar中找到重复的类

转载 作者:行者123 更新时间:2023-12-03 05:25:23 26 4
gpt4 key购买 nike

请转到文档以了解如何解决依赖关系解析错误。

在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava-jdk5:17.0)中找到重复的类

我最初创建了这个项目,该项目使用了Google的Cloud Vision API,并且一切正常。
但是现在我无法解决集成 Firestore 所需的这种依赖关系。

implementation 'com.google.firebase:firebase-firestore:21.4.3'

我努力了
implementation 'com.google.firebase:firebase-firestore:21.4.3' exclude module: 'com.google.gauva:gauva-jdk5:17.0'


configurations {
implementation.exclude module:'gauva-jdk5'
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}


implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
implementation 'com.google.guava:guava:26.0-android'


android.useAndroidX=true//causes lot of errors, tried refactoring, but core error remained
android.enableJetifier=true//no effect

正如StackOverflow,GitHub等其他大多数文章所建议的那样。我也尝试多次清理和构建。
但是到目前为止,似乎没有任何工作。包括Firestore的实现是经过验证的原因。
应用程序build.gradle是
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

defaultConfig {
applicationId "com.google.sample.cloudvision"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
buildTypes.each {
it.buildConfigField 'String', 'API_KEY', "\"AIzaSyCuSEBxcK9n6_ojdCo6uUDFALdZL2w024Y\""
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
configurations {
implementation.exclude module:'gauva-jdk5'
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
}

dependencies {
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-firestore:21.4.3' exclude module: 'com.google.gauva:gauva-jdk5:17.0'
testImplementation 'junit:junit:4.12'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.2'
//noinspection GradleCompatible
implementation 'com.android.support:design:27.0.2'
implementation 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
implementation 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
implementation 'com.google.apis:google-api-services-vision:v1-rev369-1.23.0' exclude module: 'com.google.gauva:gauva-jdk5:17.0'
// implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
// implementation 'com.google.guava:guava:26.0-android'
}

项目build.gradle是
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

初始错误日志如下

在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com.android)中找到重复的类android.support.v4.app.INotificationSideChannel .support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com)中找到重复的类android.support.v4.app.INotificationSideChannel $ Stub .android.support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar模块中找到重复的类android.support.v4.app.INotificationSideChannel $ Stub $ Proxy (com.android.support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com.android)中找到重复的类android.support.v4.os.IResultReceiver .support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com)中找到重复的类android.support.v4.os.IResultReceiver $ Stub .android.support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar模块中找到重复的类android.support.v4.os.IResultReceiver $ Stub $ Proxy (com.android.support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com.android)中找到重复的类android.support.v4.os.ResultReceiver .support:support-compat:27.0.2)
重复类android.support.v4.os.ResultReceiver $ 1在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com。 android.support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com)中找到重复的类android.support.v4.os.ResultReceiver $ MyResultReceiver .android.support:support-compat:27.0.2)
在模块core-1.0.0-runtime.jar(androidx.core:core:1.0.0)和support-compat-27.0.2-runtime.jar(com)中找到重复的类android.support.v4.os.ResultReceiver $ MyRunnable .android.support:support-compat:27.0.2)
在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava)中找到重复的com.google.common.annotations.Beta类-jdk5:17.0)
在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava)中找到的重复类com.google.common.annotations.GwtCompatible -jdk5:17.0)
在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava)中找到重复的com.google.common.annotations.GwtIncompatible类-jdk5:17.0)
在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava)中找到重复的com.google.common.annotations.VisibleForTesting类-jdk5:17.0)
在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava)中找不到重复的类com.google.common.base.Absent -jdk5:17.0)
在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava:guava)中找到重复的com.google.common.base.AbstractIterator类-jdk5:17.0)
重复模块com.google.common.base.AbstractIterator $ 1在模块guava-26.0-android.jar(com.google.guava:guava:26.0-android)和guava-jdk5-17.0.jar(com.google.guava: Guava jdk5:17.0)
......相同的错误重复大约2300000个单词.................................... ............

gradle属性-> 5.6.4

最佳答案

可能为时已晚。但是,我正在写您的问题的答案。

我遇到过同样的问题。我正在使用Youtube Data API v3。经过几次搜索并看到Stackoverflow的答案后,我将所有这些混合在一起,以某种方式起作用了!!

这是我所做的所有事情,并且有效。

  • 在应用程序级别的build.gradle文件中添加了配置。像下面
    configurations {
    implementation.exclude module:'gauva-jdk5'
    all*.exclude group: 'com.google.guava', module: 'listenablefuture' }
  • 在依赖关系块中添加了这两行

    实现“com.google.guava:listenablefuture:9999.0-empty-to-以避免与 Guava 冲突”
    实现'com.google.guava:guava:26.0-android'

  • 在youtbe数据api所需的依赖项中,我遮盖了

  • 排除组:'com.google.guava'
    就像下面
    implementation ('com.google.api-client:google-api-client-android:1.22.0') {
    exclude group: 'org.apache.httpcomponents'
    exclude group:'com.google.guava'
    }
    implementation ('com.google.apis:google-api-services-youtube:v3-rev183-1.22.0') {
    exclude group: 'org.apache.httpcomponents'
    exclude group:'com.google.guava'
    }

    如果需要,可以在GitHub gist上查看我的整个build.gradle文件 here

    谢谢 :-)

    关于android - 在模块guava-26.0-android.jar和guava-jdk5-17.0.jar中找到重复的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61480581/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com