I now have another problem. Do you midn looking again? I make the project, but Android Studio cannot find many packages.. See the screenshot.
<https://lh3.googleusercontent.com/-DUa5PYj90tM/WWvtsVqAb0I/AAAAAAAAIMo/8VGCP-DjAK0eJeizNioNCKOrrbZy3VoDQCLcBGAs/s1600/Capture.JPG> I already have dependencies { compile 'io.grpc:grpc-okhttp:1.4.0' compile 'io.grpc:grpc-protobuf-lite:1.4.0' compile 'io.grpc:grpc-stub:1.4.0' compile 'javax.annotation:javax.annotation-api:1.2' } in build.gradle. Am I still missing anything? 在 2017年7月16日星期日 UTC-7上午11:40:01,Eric Gribkoff写道: > > Can you try "./gradlew clean" and then rebuild? You can encounter this > type of error when you've already built a project using one flavor of > protobuf, then switch to another. The generated files from the old proto > flavor are not always removed automatically, causing conflicts, but > "./gradlew clean" will clear them out. > > Thanks, > > Eric > > On Sat, Jul 15, 2017 at 11:21 PM, <[email protected] <javascript:>> wrote: > >> This is my build.gradle. >> >> apply plugin: 'java' >> >> dependencies { >> compile fileTree(dir: 'libs', include: ['*.jar']) >> >> compile 'io.grpc:grpc-okhttp:1.4.0' >> compile 'io.grpc:grpc-protobuf-lite:1.4.0' >> compile 'io.grpc:grpc-stub:1.4.0' >> compile 'javax.annotation:javax.annotation-api:1.2' >> } >> >> sourceCompatibility = "1.7" >> targetCompatibility = "1.7" >> >> >> apply plugin: 'com.google.protobuf' >> >> protobuf { >> protoc { >> artifact = 'com.google.protobuf:protoc:3.0.0' >> } >> plugins { >> javalite { >> artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" >> } >> grpc { >> artifact = 'io.grpc:protoc-gen-grpc-java:1.0.0' // >> CURRENT_GRPC_VERSION >> } >> } >> generateProtoTasks { >> all().each { task -> >> task.plugins { >> javalite {} >> grpc { >> // Options added to --grpc_out >> option 'lite' >> } >> } >> } >> } >> } >> >> >> >> I copied hellowworld.proto to my module. Once I make the module, Android >> Studio gives error Duplicated class io.grpc.examples.helloworld.HelloReply. >> I searched the file explorer, the same class exists in >> build\generated\source\proto\main\java\io\grpc\examples\helloworld\HelloReply.java >> and >> D:\SimpleChat\protocol\build\generated\source\proto\main\javalite\io\grpc\examples\helloworld\HelloReply.java. >> >> >> >> <https://lh3.googleusercontent.com/-uSl8ji65z40/WWsF86qV1fI/AAAAAAAAIMc/3jlf8CfyW-EOze4XmNUZhH1lZAPR8JfRgCLcBGAs/s1600/%25E6%258D%2595%25E8%258E%25B7.JPG> >> >> >> >> I checked the sample repository in https://github.com/grpc/grpc-java, it >> only has the java one. >> >> >> How do I resolve this? >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "grpc.io" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/grpc-io. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/grpc-io/2071b2d9-9168-4b20-83ec-769215328a83%40googlegroups.com >> >> <https://groups.google.com/d/msgid/grpc-io/2071b2d9-9168-4b20-83ec-769215328a83%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/8c810d1e-727e-4df0-a046-431fde8f3ee9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
