protobuf中c++生成的string可以在java中来parse吗?
如题
我是在android中用jni回调,jni中收到的string是用c++的SerializeAsString()输出的,
在jni中我将string转为byte[]数组,回调到java中,通过java的parseFrom来解析。
现在在java端报的错误是
com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length.
但是同样的string,我在jni中用c++的ParseFromString是可以解析成功的。
proto是同一个文件,分别生成了c++和java两个版本。
用过protobuf的各路大神,请问这是什么问题??谢谢了