-
Notifications
You must be signed in to change notification settings - Fork 274
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
Does not work with android plugin #11
Comments
Try adding |
Same issue, that remove java is not the problem nor fixes it. The problem is here: https://github.com/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/ProtobufPlugin.groovy#L70 This protobuf plugin just does not support android plugin. |
The problem with the android plugin is more than just that it cannot be applied when the java plugin has already been applied. The android project is structured differently from a java project. Here I managed to get the nano protos compiled in an android project. It doesn't look very nice. The Android plugin uses a |
One more android plugin quirk gets in my way. I tried to have the protobuf plugin to call An experiment to illustrate the problem. In project.android.sourceSets.main.java.srcDir("build/generated-sources/main") If I do this instead, they won't: project.afterEvaluate {
project.android.sourceSets.main.java.srcDir("build/generated-sources/main")
} This makes it impossible to continue specifying proto files and options inside |
Anyway, although putting everything in |
What about com.android.library? |
So, this was unintentionally closed. I have checked in a comprehensive solution for Android, which should work for both library and application. It will be released as 0.5.0. Soon I will create a release branch for it, and update README in there. |
I have created the v0.5.x branch. Please follow its README and try it out. You may want to refer to testProjectAndroid as a working example for Android. |
I had manually add dependency to protobuf-nano: dependencies {
compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-3.1'
} |
It would be nice to be able to use javanano generated code with java projects and java generated code with android projects though. If I add all()*.builtins {
java {
}
} then it ends up generating both java and javanano classes and compilation fails because it finds duplicate classes. |
@manvelavetisian The all()*.builtins {
remove javanano
java {
}
} |
0.5.0 has been released. Please refer to the instructions from the master README. |
This plugin does not work with the android plugin for gradle, since it applies the java plugin.
The text was updated successfully, but these errors were encountered: