google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.77k stars 273 forks source link

Execution failed for task ':app:generateDebugProto'. > protoc: stdout: . stderr: Missing output directives. #705

Open MontreaI opened 1 year ago

MontreaI commented 1 year ago

It looks like I am receiving this error:

Execution failed for task ':app:generateDebugProto'.
> protoc: stdout: . stderr: Missing output directives.

I believe I have correctly configured both my project and app level gradles:

project gradle

buildscript {
    dependencies {
        classpath "com.google.protobuf:protobuf-gradle-plugin:$proto_version"
     }
}

plugins {
    id 'org.jetbrains.kotlinx.kover' version "$kover_version"
    id "com.google.protobuf" version "$proto_version" apply false
}

app gradle

apply plugin: 'com.google.protobuf'
apply plugin: 'com.android.application'

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.21.12'
    }
    plugins {
        javalite {
            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
        }
    }
    generateProtoTasks {
        ofSourceSet("main").forEach { task ->
            task.builtins {
                getByName("java") {
                    option("lite")
                }
                getByName("kotlin") {
                    option("lite")
                }
            }
            task.plugins {
                javalite { }
            }
        }
    }
}

dependencies {
    implementation 'com.google.protobuf:protobuf-javalite:3.23.0'
    implementation 'com.google.protobuf:protobuf-kotlin-lite:3.23.0'
}
ktKongTong commented 1 year ago

same error. This issue comment helped me solve the problem