Cloud Firestore与gRPC构建错误 [英] Cloud Firestore with gRPC build error

查看:519
本文介绍了Cloud Firestore与gRPC构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个android应用程序,它必须使用gRPC和Firestore。但是,当我从'io.grpc'组依赖项(例如io.grpc:grpc-okhttp:1.7.0)和firestore依赖项(com.google.firebase:firebase-firestore:11.4.2)中添加了一个模块构建gradle配置,我得到一个构建错误无法合并dex。 'stacktrace'构建选项后,我看到问题是

I’m working on an android application, which have to use gRPC and Firestore. However, when I added both one of module from ‘io.grpc’ group dependency (e.g. io.grpc:grpc-okhttp:1.7.0) and firestore dependency (com.google.firebase:firebase-firestore:11.4.2) in the build gradle config, I got a build error "Unable to merge dex". After with ‘stacktrace’ build option, I saw that the problem is

Multiple dex files define Lio/grpc/internal/OobChannel$5;

如果firestore使用grpc-core模块,可能会发生这种情况,但在树依赖关系中没有类似的情况,我使用了[androidDependencies] gradle任务。我尝试像这样排除io.grpc:

It could happen if firestore uses grpc-core module, but there is no one similar in tree dependencies, which I got using [androidDependencies] gradle task. I tried to exclude io.grpc like this:

implementation ('com.google.firebase:firebase-firestore:11.4.2') {
    exclude group: 'io.grpc'
}

但是有同样的错误。然后我想,如果我把grpc模块依赖关系中的所有'io.grpc。'传递依赖关系排除在外,为内部类添加grpc-core。通过这种方式,我为测试写了丑陋的依赖关系。

but there was the same error. Then I thought what if I exclude all ‘io.grpc.’ transitive dependencies from grpc module dependencies with adding grpc-core for internal classes. In this way, I wrote ugly dependencies just for test

implementation 'com.google.firebase:firebase-firestore:11.4.2'
implementation('io.grpc:grpc-okhttp:1.7.0') {
    exclude group: 'io.grpc'
}
implementation('io.grpc:grpc-protobuf-lite:1.7.0') {
    exclude group: 'io.grpc'
}
implementation('io.grpc:grpc-stub:1.7.0') {
    exclude group: 'io.grpc'
}
implementation 'io.grpc:grpc-core:1.7.0'

当它成功编译时,我感到很惊讶,但在启动应用程序之后,它崩溃了java.lang.RuntimeException:Firestore中的内部错误(0.6.6-dev)

I was surprised when it successfully compiled, but after launch app, it crashed with java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev)

Caused by: java.lang.NoSuchMethodError: No static method zzcyc()Lio/grpc/ManagedChannelProvider; in class Lio/grpc/ManagedChannelProvider; or its super classes (declaration of 'io.grpc.ManagedChannelProvider' appears in /data/app/com.zipr.test-2/split_lib_dependencies_apk.apk)

我使用gradle 3.0.0-rc1来启用multidex支持。我删除.gradle,建立目录,清理重建项目,但我仍然有生成错误。我能做些什么来解决这个问题?

I use gradle 3.0.0-rc1 with enabling multidex support. I deleted .gradle, build directories, cleaned rebuilt project, but I still have build error. What can I do to resolve this problem?

推荐答案

由于各种因素限制了我们在Google上构建Android SDK的方式,Firestore会自行编制gRPC的副本。不幸的是,这是漏洞,你正在遇到的后果:11.4.2 Firestore SDK与任何外部gRPC不兼容: - (。

Due to a variety of factors that constrain the way we build Android SDKs at Google, Firestore proguards a copy of gRPC within itself. Unfortunately this is leaky and you're running into the fallout: the 11.4.2 Firestore SDK is incompatible with any external gRPC :-(.

这实质上是我们的首要问题对于Firestore Android SDK,我很遗憾,你已经遇到了它。

This is essentially our top issue for the Firestore Android SDK and I'm sorry you've run into it.

这篇关于Cloud Firestore与gRPC构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆