Adi*_*ata 3 android gradle firebase android-studio google-cloud-firestore
我最初制作了这个项目,它使用了 Google 的 Cloud Vision API,一切都运行良好。但现在我无法解决集成Firestore所需的这种依赖关系。
implementation 'com.google.firebase:firebase-firestore:21.4.3'
Run Code Online (Sandbox Code Playgroud)
我努力了
implementation 'com.google.firebase:firebase-firestore:21.4.3' exclude module: 'com.google.gauva:gauva-jdk5:17.0'
Run Code Online (Sandbox Code Playgroud)
和
configurations {
implementation.exclude module:'gauva-jdk5'
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
Run Code Online (Sandbox Code Playgroud)
和
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
implementation 'com.google.guava:guava:26.0-android'
Run Code Online (Sandbox Code Playgroud)
和
android.useAndroidX=true//causes lot of errors, tried refactoring, but core error remained
android.enableJetifier=true//no effect
Run Code Online (Sandbox Code Playgroud)
正如 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'
}
Run Code Online (Sandbox Code Playgroud)
项目 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
}
Run Code Online (Sandbox Code Playgroud)
初始错误日志如下
在模块 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- 中找到重复的类 android.support.v4.app.INotificationSideChannel$Stub compat-27.0.2-runtime.jar (com.android.support:support-compat:27.0.2) 在模块 core-1.0.0-runtime 中找到重复的类 android.support.v4.app.INotificationSideChannel$Stub$Proxy。 jar (androidx.core:core:1.0.0) 和 support-compat-27.0.2-runtime.jar (com.android.support:support-compat:27.0.2) 重复类 android.support.v4.os.IResultReceiver在模块 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 中找到重复的类 android.support.v4.os.IResultReceiver$Stub$Proxy (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 模块中找到重复的类 android.support.v4.os.ResultReceiver。 jar (androidx.core:core:1.0.0) 和 support-compat-27.0.2-runtime.jar (com.android.support:support-compat:27.0.2) 重复类 android.support.v4.os.ResultReceiver在模块 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) 中找到 $1 )在模块 core-1.0.0-runtime.jar (androidx.core:core:1.0.0) 和 support-compat-27.0.2-runtime.jar 中找到重复的类 android.support.v4.os.ResultReceiver$MyResultReceiver ( com.android.support:support-compat:27.0.2) 在模块 core-1.0.0-runtime.jar (androidx.core:core:1.0.0) 中找到重复的类 android.support.v4.os.ResultReceiver$MyRunnable和 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-jdk5:17.0) 在模块 guava-26.0- 中找到重复的类 com.google.common.annotations.GwtCompatible android.jar (com.google.guava:guava:26.0-android) 和 guava-jdk5-17.0.jar (com.google.guava:guava-jdk5:17.0) 在 com.google.common.annotations.GwtInknown 中找到重复的类模块 guava-26.0-android.jar (com.google.guava:guava:26.0-android) 和 guava-jdk5-17.0.jar (com.google.guava:guava-jdk5:17.0) 重复类 com.google.common。 Comments.VisibleForTesting 在模块 guava-26.0-android.jar (com.google.guava:guava:26.0-android) 和 guava-jdk5-17.0.jar (com.google.guava:guava-jdk5:17.0) 中找到重复的类 com .google.common.base.Absent 在模块 guava-26.0-android.jar (com.google.guava:guava:26.0-android) 和 guava-jdk5-17.0.jar (com.google.guava:guava-jdk5:17.0) 在模块 guava-26.0-android 中找到重复的类 com.google.common.base.AbstractIterator .jar (com.google.guava:guava:26.0-android) 和 guava-jdk5-17.0.jar (com.google.guava:guava-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 个单词中重复出现............ ....
等级属性 -> 5.6.4
小智 9
也许已经太晚了。不过,我正在写一个针对您问题的答案。
我遇到过同样的问题。我使用的是 Youtube Data API v3。经过几次搜索并看到 Stackoverflow 的答案后,我将它们全部混合在一起,不知何故它起作用了!
这就是我所做的一切并且有效。
将配置添加到应用程序级别build.gradle
文件。像下面这样
configurations {
implementation.exclude module:'guava-jdk5'
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
Run Code Online (Sandbox Code Playgroud)
在依赖块中添加这两行
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
implementation 'com.google.guava:guava:31.1-android'
Run Code Online (Sandbox Code Playgroud)
在 youtube data api 所需的依赖项中,我有
exclude group:'com.google.guava'
Run Code Online (Sandbox Code Playgroud)
就像下面这样
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'
}
Run Code Online (Sandbox Code Playgroud)
如果需要,您可以在 GitHub gist上查看我的整个build.gradle
文件。
谢谢 :-)
归档时间: |
|
查看次数: |
2277 次 |
最近记录: |