1

我用

protoc -I examples/src/main/proto -I examples/build/extracted-protos/main --java_out=examples/build/generated-sources/main --java_plugin_out=examples/build/generated-sources/main --plugin=protoc-gen-java_plugin=compiler/build/binaries/java_pluginExecutable/java_plugin examples/src/main/proto/route_guide.proto

生成代码。

当我为这个 proto 文件修改 Android 演示时,运行./gradlew installDebug 我遇到了一个问题:

no suitable constructor found for HelloRequest()
            HelloRequest message = new HelloRequest();
                                   ^
    constructor HelloRequest.HelloRequest(CodedInputStream,ExtensionRegistryLite) is not applicable
      (actual and formal argument lists differ in length)
    constructor HelloRequest.HelloRequest(Builder) is not applicable
      (actual and formal argument lists differ in length)
4

1 回答 1

0

我解决了:</p>

protoc --plugin=protoc-gen-java_rpc=compiler/build/binaries/java_pluginExecutable/java_plugin --java_rpc_out=nano=true:"examples/build/generated-sources/main/" --proto_path="examples/src/main/proto/" --javanano_out=ignore_services=true:"examples/build/generated-sources/main/" "examples/src/main/proto/helloworld.proto"
于 2015-03-13T06:55:08.423 回答