【发布时间】:2020-08-12 06:56:11
【问题描述】:
转到文档了解如何修复依赖解析错误。
在模块 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.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: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: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) 在模块 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: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: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) 在模块 guava-26.0-android.jar (com.google.guava:guava:26.0-android) 和 guava-jdk5-17.0.jar (com.google.guava:番石榴-jdk5:17.0) ......相同的错误重复了大约 2300000 个单词...................... …………
gradle 属性 -> 5.6.4
【问题讨论】:
标签: android firebase android-studio gradle google-cloud-firestore