问题描述
以下是我添加到我的gradle文件中的代码,以解决protobuf中重复出现的GeneratedMessageLite类问题,在该问题上我遇到错误:
原因:协议:标准输出:。 stderr:google / protobuf / descriptor.proto:找不到文件。
google / api / annotations.proto:20:1:找不到导入的“ google / protobuf / descriptor.proto”或有错误。
google / api / annotations.proto:26:8:未定义“ google.protobuf.Methodoptions”。 google / api / annotations.proto:19:1:警告:导入google / api / http.proto但未使用。
android{
packagingOptions {
exclude 'meta-inf/DEPENDENCIES'
exclude 'meta-inf/INDEX.LIST'
exclude 'meta-inf/LICENSE'
exclude 'meta-inf/LICENSE.txt'
exclude 'meta-inf/license.txt'
exclude 'meta-inf/NOTICE'
exclude 'meta-inf/NOTICE.txt'
exclude 'meta-inf/notice.txt'
exclude 'meta-inf/ASL2.0'
exclude("meta-inf/*.kotlin_module")
}
configurations.all {
exclude group:'com.google.api.grpc',module:'proto-google-common-protos'
exclude group: 'com.google.protobuf',module: 'protobuf-java'
exclude group: 'com.google.guava',module: 'guava-jdk5'
}
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.8.0'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
}
}
}
}
}
dependencies {
implementation "io.grpc:grpc-okhttp:1.31.1"
implementation "io.grpc:grpc-stub:1.31.1"
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation 'com.google.protobuf:protobuf-javalite:3.12.0'
implementation 'com.google.cloud:google-cloud-speech:1.24.0'
implementation 'com.google.api.grpc:grpc-google-cloud-speech-v1:1.23.0';
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)