As per https://github.com/google/protobuf/tree/master/javanano, setting the "parcelable_messages" option as "true" should make the generated messages parcelable within the context of Android. However, setting that option as "true" results in errors stating
"error: package com.google.protobuf.nano.android does not exist"
on these types
com.google.protobuf.nano.android.ParcelableMessageNano
com.google.protobuf.nano.android.ParcelableMessageNanoCreator
in the protobuf gradle plugin generated java file within Android Studio 1.4.1.
Adding the
com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-4
artifact as a compile type dependency does not seem to resolve the error.
A cursory search in the protobuf repo suggests that these types do not exist in the google/protobuf repo. However, they do exist in the android.googlesource repo at https://android.googlesource.com/platform/external/protobuf.git/+/master/java/src/device/main/java/com/google/protobuf/nano/android. They are in the "device" sourceSet and not the "main" sourceSet.
Any updates on this issue?
@xfxyjwf Would it be possible to share an approximate timeline for the resolution of this bug?
@haberman @pherl , if I am not wrong, #1308 seems to be a duplicate of this bug report.
I am not sure, but could the bug resolution be just that the android.googlesource.com repo files (referred to in the original bug report) need to be provisioned in this repo?
@Brahmasmi Yes, I think adding these missing files to protobuf repo will solve the problem. Could you help make a pull request adding them?
I am afraid I would not be able to make the pull request, primarily because neither do I have knowledge about this code base nor the infrastructure for this - https://github.com/google/protobuf/blob/master/javanano/README.md#contributing-to-nano.
Could someone within the team with knowledge of android as well as protobuf javanano pick this up? And also probably add some test cases around the command line arguments.
No one control it?The question is stupid。
parcelable_messages should not be used anymore, it easily causes conflicts at runtime on the classpath if the same proto file is compiled with and without the flag.
Additionally, this behavior can easily be implemented via a helper class that does not require modifying generated code.
The option parcelable_messages will no longer be supported. Closing this issue as "won't fix".
@xfxyjwf @kurtisnelson
Could the README at https://github.com/google/protobuf/tree/master/javanano be updated to reflect the current position? Thanks.
Additionally, could you folks help us non-Google volks with #2730 ?
@kurtisnelson I was looking for a way to use the option parcelable_messages. What do you mean by helper class? Do you have a sample?
Thank you.
Most helpful comment
@kurtisnelson I was looking for a way to use the option parcelable_messages. What do you mean by helper class? Do you have a sample?
Thank you.