I got it resolved
Below is the solution
The problem came because of the way the way bytes were extracted from
the payload after building.

This was the earlier code which caused the problem.

ByteArrayOutputStream result = new ByteArrayOutputStream();
payload.build().writeTo(result);
return result.toString().toBytes();

In this the payload once the payload is built it is being written to a
bytearray stream and then converted to a string and then is converted
to bytearray which is causing the problem because it is inserting some
invalid invariant into the byte array.

instead of which the payload class provides a convenient method
toByteArray() which have to be used.

changed the above code to

p = payload.build();   //p is a payload object.
return p.toByteArray();


Regards
Rashmi



On Jun 15, 11:26 am, Rashmi <[email protected]> wrote:
> message info
> {
>                required string username =1;
>                required string pwd =2;
>                required string pin                      =3;
>                required string imei                     =4;
>                required string imsi                     =5;
>                required string phoneNumber              =6;
>                required string deviceName               =7;
>                required string userName                 =8;
>                required string platform                 =9;
>                required string manufacturer             =10;
>                required string model                    =11;
>                required string os                       =12;
>                required string screenLanguage           =13;
>                required string screenResolution         =14;
>                required string totalExternalMemory      =15; // in MB
>                required string freeExternalMemory       =16; // in MB
>                required string totalPhoneMemory         =17; // in MB
>                required string freePhoneMemory          =18;
>                required string batteryLevel             =19;
>
> }
>
> When I try deserialising the info proto object, I get an exception
> “ProtocolMessage had invalid wire type”. This is observed in android
> build only.
>
> Important Note: Everything works fine when I create and run a java
> project.
> I have tried with both version ofprotocolbuffer 2.2.0 and 2.3.0.
> Any help is appreciated.
>
> You can browse this link for more info onprotocolbuffer 
> objecthttp://code.google.com/apis/protocolbuffers/docs/overview.html
>
> Thanks
> Rashmi

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to