apply plugin: 'java-library' apply plugin: 'com.google.protobuf' sourceSets { main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite" } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) api 'com.google.protobuf:protobuf-lite:3.0.1' } protobuf { protoc { // You still need protoc like in the non-Android case artifact = 'com.google.protobuf:protoc:3.0.0' } plugins { javalite { // The codegen for lite comes as a separate artifact artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0' } } generateProtoTasks { all().each { task -> task.builtins { // In most cases you don't need the full Java output // if you use the lite output. remove java } task.plugins { javalite {} } } } }