参考文档,了解如何修复依赖解析错误。
* 在模块guava-26.0-android.jar(com. google. guava:guava:26.0-android)和guava-jdk5-17.0.jar(com. google. guava:guava-jdk5:17.0)中发现重复的类 *
我最初做了这个项目,使用谷歌的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中发现重复的类android.support.v4.app.INotificationSideChannel(androidx. core:core:1.0.0)和support-compat-27.0.2-runtime.jar(www.example.com:support-compat:27.0.2)在模块core-1.0中发现重复的类android.support.v4.app.INotificationSidebookel$Stub.0-runtime.jar(androidx. core:core:1.0.0)和support-compat-27.0.2-runtime.jar(www.example.com:support-compat:27.0.2)在模块核心中发现重复的类android.support.v4.app.INotificationSideProxy el$Stub$Proxy---@.0.0-runtime.jar(androidx. core:core:1.0.0)和support-compat-27.0.2-runtime.jar(www.example.com:support-compat:com.android.support 27.0.2)在模块core-1.0.0-runtime.jar(androidx. core:core:1.0.0)和support-compat-27.0.2-runtime.jar(www.example.com:support-compat:com.android.support 27.0.2)在模块core-1.0.0-runtime.jar(androidx. core:core:1.0.0)和support-compat-27.0.2-runtime.jar(www.example.com:support-compat:com.android.support(com. google. guava:guava:26.0-android)和guava-jdk5-17.0.jar(com. google. guava:guava-jdk5:17.0)在模块guava-26.0-android.jar中找到重复的类com. google. common. annotations. Gwt Compatiblecom.android.support(com. google. guava:guava-jdk5:17.0)重复的类com. google. common. annotations. Gwt在模块guava-26.0-android.jar中发现不兼容com.android.support(com. google. guava:guava-jdk5:17.0)在模块guava-26.0-android.jar中找到重复的类com. google. common. annotations. VisibleForTesting(com. google. guava:guava:26.0-android)和guava-jdk5-17.0.jarcom.android.support(com. google. guava:guava:26.0-android)和guava-jdk5-17.0.jar(com. google. guava:guava-jdk5:17.0)在模块guava-26.0-android.jar中发现重复的类com. google. common. base. AbstractIteratorcom.android.support(com. google. guava:guava-jdk5:17.0)在模块guava-26.0-android.jar中发现重复的类com.google.common.base.AbstractIterator$1com.android.support
gradle属性-> 5.6.4
2条答案
按热度按时间nwnhqdif1#
也许已经太晚了。不过,我正在给你写一个问题的答案。
我也有同样的问题。我使用的是Youtube数据API v3。经过几次搜索和看到Stackoverflow的答案,我混合了所有的,不知何故它工作了!!
这就是我所做的一切,它起作用了。
1.添加 * 配置 * 到应用程序级别
build.gradle
文件。如下所示字符串
1.在依赖块中添加了这两行
型
1.在YouTube数据所需的依赖项中,我有API,
型
就像下面
型
如果你愿意,你可以在GitHub gist上查看我的整个
build.gradle
文件here。Thank you:-)
krcsximq2#
我通过在我的应用程序级别gradle
configurations { implementation.exclude module:'guava-jdk5' }
中添加下面的行解决了这个错误