gpt4 book ai didi

android - 如何处理显然相互覆盖的gradle依赖项

转载 作者:行者123 更新时间:2023-12-03 05:07:01 27 4
gpt4 key购买 nike

我正在使用Google Firebase(身份验证和Cloud Firestore)开发应用程序。
documentation之后,我应该将以下依赖项添加到我的应用程序级别build.gradle文件中,以便访问云Firestore数据库

implement 'com.google.firebase:firebase-admin:6.8.1'

但是,这种方法在编译时会产生以下错误:

“注释处理器必须立即显式声明。发现以下与编译类路径有关的依赖关系包含注释处理器。请将它们添加到注释处理器配置中。
-auto-value-1.4.jar(com.google.auto.value:auto-value:1.4)
或者,将android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true设置为继续先前的行为。请注意,此选项已弃用,以后将被删除。
有关更多详细信息,请参见https://developer.android.com/r/tools/annotation-processor-error-message.html。”


我已尝试解决此问题,如错误消息中链接的网站所述,方法是将依赖项替换为:
compileOnly 'com.google.firebase:firebase-admin:6.8.1'
annotationProcessor 'com.google.auto.value:auto-value:1.4'

这样可以消除旧错误,但会导致另一个我无法修复的问题。添加依赖项 'com.google.firebase:firebase-admin:6.8.1'会导致 'com.google.firebase:firebase-auth:17.0.0'依赖项中的某些方法不再起作用。

“错误:找不到符号方法getCurrentUser()
错误:找不到符号方法signInWithCredential(AuthCredential)“


我的第一个想法是admin依赖项包括auth拥有的某些类。但是,对于这种情况下的gradle行为以及如何解决这一问题,我并不是很了解。

以下是我对build.gradle文件的依赖
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.facebook.android:facebook-login:[5,6)'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
compileOnly 'com.google.firebase:firebase-admin:6.8.1'
annotationProcessor 'com.google.auto.value:auto-value:1.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
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'
}

最佳答案

firebase-admin依赖项不能在客户端应用程序中使用。它与服务器代码一起使用。它可能与适用于Android的Firebase客户端SDK冲突。如果要使用firebase-admin,则将需要一个后端组件到您的应用程序并在其中调用它。

关于android - 如何处理显然相互覆盖的gradle依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56564250/

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