Protobuf generated code is indeed very large. There are a couple options you can use to reduce it.
On Android, you usually want to use protobuf-lite. To do that, add this to your .proto file: option optimize_for = LITE_RUNTIME; Then, the generated code will only depend on the "lite" version of the protobuf runtime, which is much smaller than the full version. See the README.txt in the source code package for instructions on building the lite runtime library. However, this option only really reduces the size of the runtime library, not the generated code. There is another option that reduces the generated code size (at the expense of speed): option optimize_for = CODE_SIZE; Unfortunately, the CODE_SIZE setting requires the *full* runtime library. This option is really better for large servers. For Android I think you need to go with LITE_RUNTIME. You might also look at some of the third-party j2me protobuf implementations as they might be smaller. On Thu, Oct 28, 2010 at 12:20 AM, ZHOU Xiaobo <[email protected]> wrote: > I want to use protobuf in an android project, > but when I generated a jar for all protocols I used, > I found that it's 300KB large. > > So does android have the plan to migrate protobuf? > thx > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<protobuf%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" 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/protobuf?hl=en.
