在Retrofit中使用Protobuf转换器时出现异常?我试图使用proto buf对Json响应进行反序列化

时间:2016-07-11 06:11:53

标签: retrofit protocol-buffers

>

 java.lang.RuntimeException: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.
        at retrofit2.converter.protobuf.ProtoResponseBodyConverter.convert(ProtoResponseBodyConverter.java:40)
        at retrofit2.converter.protobuf.ProtoResponseBodyConverter.convert(ProtoResponseBodyConverter.java:26)
        at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:116)
        at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
        at com.testing.InvokeTestingPOS.main(InvokeTestingPOS.java:31)
Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.
        at com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:99)
        at com.google.protobuf.UnknownFieldSet$Builder.mergeFieldFrom(UnknownFieldSet.java:515)
        at com.google.protobuf.GeneratedMessage.parseUnknownField(GeneratedMessage.java:205)
        at json2pb.TestingInfo.<init>(TestingInfo.java:61)
        at json2pb.TestingInfo.<init>(TestingInfo.java:9)
        at json2pb.TestingInfo$1.parsePartialFrom(TestingInfo.java:131)
        at json2pb.TestingInfo$1.parsePartialFrom(TestingInfo.java:126)
        at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:192)
        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:209)
        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
        at retrofit2.converter.protobuf.ProtoResponseBodyConverter.convert(ProtoResponseBodyConverter.java:38)

0 个答案:

没有答案