【发布时间】:2019-06-25 03:05:51
【问题描述】:
我正在使用 Google Speech github android 项目。在升级所有文件版本后,它终于设法解决了一个问题,我无法解决它。 这里错误消息:
Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-3.8.0.jar (com.google.protobuf:protobuf-java:3.8.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
还有数百行带有类似警告。
为了解决这个问题,我尝试了许多其他版本的“io.grpc:grpc-protobuf-lite:1.21.0”和“com.google.protobuf:protobuf-java:3.8.0”,方法是更改它们的编号,但没有任何匹配项这些方法,我不断收到错误消息。
奇怪的事实是:升级 3.0.1 的 "io.grpc:grpc-protobuf-lite: ---" 会出现此错误:ERROR: Failed to resolve: io.grpc:grpc-protobuf-lite:3.0.1
Show in Project Structure dialog
Affected Modules: app
但将其保持在 1.21.0 的版本不会给出任何错误错误,但会显示重复的错误消息,其中明显包含不应该存在的 3.0.1 版本。
这是我的 gradle 中的依赖项列表:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Support libraries
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
// gRPC
implementation "io.grpc:grpc-okhttp:$grpcVersion"
implementation "io.grpc:grpc-stub:$grpcVersion"
implementation "io.grpc:grpc-protobuf-lite:3.0.1"
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation 'com.google.protobuf:protobuf-java:3.8.0'
// OAuth2 for Google API
implementation('com.google.auth:google-auth-library-oauth2-http:0.16.0') {
exclude module: 'httpclient'
}
// Tests
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'}
我该如何解决这个重复的错误信息?
【问题讨论】:
-
你为什么使用精简版和完整版的protobuf?只选择一个并删除另一个。
-
嘿,谢谢。这一切都在那个项目中。两个版本。删除 lite 版本破坏了项目。删除非精简版解决了它。
-
不客气,很高兴你把它修好了
-
添加翻译客户端依赖项后,此重复类错误消息再次出现。
-
它是什么依赖?
标签: java android google-cloud-platform