0

Currently my proto datastore setup is generating Java classes. Is it possible to generate Kotlin classes instead?

lostintranslation
  • 23,756
  • 50
  • 159
  • 262

1 Answers1

0

Compile your .proto example command

the kotlin code is produced on top of java code hence it required two flags one for generating java code and another for kotlin code.

protoc --proto_path=src --java_out=build/gen/java --kotlin_out=build/gen/kotlin src/foo.proto

Source : More info also check Kotlin tutorial

Nakul
  • 1,313
  • 19
  • 26
  • Do you know if this is built into the gradle plugin? https://github.com/google/protobuf-gradle-plugin#default-outputs – lostintranslation Jun 21 '22 at 19:42
  • I don't know, but with some searching I found that this plugin supports for kotlin, Check sample code https://github.com/google/protobuf-gradle-plugin/issues/536 which requires the additional kotlin dependency https://mvnrepository.com/artifact/com.google.protobuf/protobuf-kotlin – Nakul Jun 22 '22 at 08:59