AndroidでGrpcクライアントを作成したいと思います。私はここでthis tutorialAndroid用のProtobuf:エラーコンパイル時にProtocファイルに定義された重複クラス
に従ってください、私の外側build.gradle
ファイルです:私はプロジェクトをビルドしようとしたとき、私は常にエラーを満たす
dependencies {
compile 'com.android.support:appcompat-v7:23.+'
// You need to build grpc-java to obtain these libraries below.
compile 'io.grpc:grpc-okhttp:1.3.0' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-protobuf-lite:1.3.0' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-stub:1.3.0' // CURRENT_GRPC_VERSION
compile 'javax.annotation:javax.annotation-api:1.2'
}
:ここ
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"
}
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.2.0"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.3.0'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
は私の内側のファイルがbuild.gradle
ファイルです
Error:(14, 15) error: duplicate class: io.grpc.routeguideexample.Feature
Error:(13, 15) error: duplicate class: io.grpc.routeguideexample.FeatureDatabase
// ...
Feature
...私はprotocファイルで定義したクラスです。私のコードで何が間違っているのか理解してください。あなたのコード内のJavaクラスio.grpc.routeguideexample.Feature
を定義した場合
おかげ