我正在尝试更新 Android BluetoothChat 示例的代码以使用 Protobuf 进行更结构化的数据交换。我还需要 byte[] 数组字段来发送任意数据,例如图像字节数组,但在尝试编译 .proto 文件时,出现以下错误。
protofiles/bluetoothmessage.proto:8:18:预期的字段名称。
下面是我的 .proto 文件。
package bluetoothmessage;
option java_package = "com.example.bluetoothexample";
option java_outer_classname = "ProtocolBuffers";
message BTMessage {
required int32 cmd = 1;
optional byte[] appData = 2;
}
stackoverflow 上的其他几篇文章提到 byte[] 可以用作字段,下面的页面也说了同样的事情。
https://developers.google.com/protocol-buffers/docs/proto#scalar
非常感谢任何帮助!谢谢!!
最佳答案
关于android - Protocol Buffer 支持 byte[] 字段吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24898261/