在尝试为给定的protobuf类创建newBuilder()对象时,我遇到了以下错误。在类路径中有protobuf-java-2.4.1.jar。
同样在服务器端工作但在客户端失败。
java.lang.VerifyError: Bad return type Exception Details: Location: packagename.QuerySpecProtos$QuerySpec$Builder.clone()Lcom/google/protobuf/AbstractMessageLite$Builder; @4: areturn Reason: Type 'packagename.QuerySpecProtos$QuerySpec$Builder' (current frame, stack[0]) is not assignable to 'com/google/protobuf/AbstractMessageLite$Builder' (from method signature) Current Frame: bci: @4 flags: { } locals: { 'packagename.QuerySpecProtos$QuerySpec$Builder' } stack: { 'packagename.QuerySpecProtos$QuerySpec$Builder' } Bytecode: 0000000: 2ab6 0062 b0
答案 0 :(得分:1)
看起来版本不匹配。您需要确保两者:
protoc
来匹配jar。