I want to write a Grpc client on Android. I follow this tutorial
Here is my outer build.gradle file:
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()
}
}
Here is my inner file build.gradle file:
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'
}
When I tried to build project, I always meet errors:
Error:(14, 15) error: duplicate class: io.grpc.routeguideexample.Feature
Error:(13, 15) error: duplicate class: io.grpc.routeguideexample.FeatureDatabase
// ...
With Feature ... is class that I have defined in protoc file. Please help me figure out what wrong in my code.
Thanks