-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proto import statement from Android project to Android project broken? #56
Comments
Sorry for taking so long. This is a known missing feature, which is marked as a TODO in the source code. I didn't do it partially because the doubt of whether this feature would be needed, and that I was not familiar with Android development thus I was not sure I could do it right. |
I am trying to figure out how to include protos in the artifact of a Android library project. In Java project I can just include the files in the |
My way of solving problem with import proto files from android library (project). If android library is local and connected this way:
I didn't find the way to put proto files in .aar (android library package). But I created external only java library with only proto files and connect it to our android library:
This way all protobuf files remain in jar file of androidlibraryproto.gradle
androidlibrary.gradle
app.gradle
When we decided to upload android library to JCenter and use this way:
This way we can't leave We have to ways:
Now I'm using last way, I uploaded proto files to JCenter separately and compile it in |
Seems this was probably fixed by #440. |
I accidentally opened this in the old repository.
I have two Android libraries, both of which have protos. ProjectB depends on ProjectA -- compile project(':projectA'). The only non-standard thing I've done is to disable nano protos and use the normal style protos (reverting that doesn't solve my problem).
Both protos can compile just fine when they're independent. However, if I add an import statement within protoB.proto to protoA.proto, I get an error:
protoA.proto: File not found.
protoB.proto: Import "protoA.proto" was not found or had errors.
I think this issue is similar to #22 but in my case, both projects are Android instead of plain Java. Should this work?
https://github.com/google/protobuf-gradle-plugin/blob/master/testProjectAndroid/build.gradle shows an Android app depending on protos defined in another Java project. If that works, shouldn't it still work when the other project is an Android project?
Should I move all protos into their own Java projects and have the Android projects depend on that instead?
Details:
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.1'
proto_library_version = '3.0.0-beta-1'
google_proto_library = "com.google.protobuf:protobuf-java:${proto_library_version}"
google_protoc_artifact = "com.google.protobuf:protoc:${proto_library_version}"
I just confirmed my theory by converting ProjectA to a Java project (ProjectB is still an Android library). All of the sudden, protoB.proto is allowed to import a proto from protoA.proto.
In my case, I think I can just convert both of them to Java projects and be done with it. I made them Android library projects even though they only contain regular Java (there was some limitation with Android and eclipse long ago). But it still seems like this shouldn't be a restriction.
The text was updated successfully, but these errors were encountered: