google / google/protobuf-gradle-plugin

Generated class not accessible in andoid studio in version 0.10

Open
#814 6 comments 4 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
1.8k
Forks
288
PR merge metrics
No merged PRs in 30d

Description

I am using:
Android Studio Quail 1 | 2026.1.1
gradle-9.5.0-bin
id ("com.google.protobuf") version "0.10.0" apply false
Kotlin 2.4

```
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:4.35.0"
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
register("java") {
option("lite") // use javalite for Android
}
}
}
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType().configureEach {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
freeCompilerArgs.add("-Xdebug")
}
}
```

this is my gradle config:
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
org.gradle.configuration-cache=true
org.gradle.caching=true

but when protobuf files get compiled, i can not access them in android studio. i put them in main/proto/...
after build they are in folder: build/generated/java/generatedReleaseProto/java/.... but in android studio they are unknown class and not found
the problem happened just after i upgrade to protobuf version 0.10

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown Gradle configuration and proto files under main/proto, then inspect build/generated/java/generatedReleaseProto/java and Android Studio's source indexing after upgrading the protobuf plugin to 0.10. Done means the generated classes are recognized and accessible in Android Studio, not only present after the build.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.