如何解决收到错误google / protobuf / descriptor.proto:找不到文件从protobuf java迁移到protobuf javalite
以下是我添加到我的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 举报,一经查实,本站将立刻删除。