Reputation: 711
I'm trying to use Protobuf in my Android application. So to do that, I added the following lines in my gradle.build file :
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.5.0"
}
}
apply plugin: "com.google.protobuf"
sourceSets {
main {
proto {
// In addition to the default 'src/main/proto'
srcDir '../../../Libs/Protocol'
}
}
}
protobuf {
protoc {
path = '/usr/local/bin/protoc'
}
}
The thing is I get an error when gradle builds. It says that :
Error:Execution failed for task ':app:generateDebugProto'.
> protoc: stdout: . stderr: protoc-gen-javanano: program not found or is not executable
--javanano_out: protoc-gen-javanano: Plugin failed with status code 1.
Can you help me with this issue ? I have no idea of how to fix it.
Thank you in advance !
Upvotes: 1
Views: 2565
Reputation: 51
This means that the version of protoc
you're using doesn't support javanano. An easy fix would be to use pre-compiled protoc
on Maven Central by adding the following to your build.gradle
(as suggested by the documentation of the protobuf gradle plugin):
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0-alpha-3'
}
}
Upvotes: 1