coolchandrakumar
com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.
at com.google.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:1563)
try { //val stream = assets.open("JsonData.json") val jsonString = "{\"platform\":\"chan\"}" val chanData = ChanDataProto.ChanData.parseFrom(jsonString.encodeToByteArray()) Log.d("ChanLog", "Value: ${chanData.platform}") } catch (ex: Exception) { ex.printStackTrace() }
syntax = "proto3"; package tutorial; option java_package = "com.chan.chanprotobuf"; option java_outer_classname = "ChanDataProto"; message ChanData { string platform = 1; }
{ "platform": "chan" }
A modern programming language that makes developers happier.