android / android/codelab-android-datastore
Could not get unknown property 'source' for generate-proto-generateDebugProto of type
- Dominant language
- Kotlin
- Stars
- 240
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
These are 2 errors that I've faced on [Working with Proto DataStore](https://developer.android.com/codelabs/android-proto-datastore#4):
`Could not get unknown property 'source' for generate-proto-generateDebugProto of type`
and
`error: Unresolved reference: protoc`
On gradle-8.11.1 and kotlin-gradle.
Here is the resolve:
In build.gradle instead of previous protobuf version:
```
protobuf {
protoc {
//the version here should be the same as what you have in your app build.gradle
artifact = "com.google.protobuf:protoc:3.18.0"
}
generateProtoTasks {
all().configureEach {
builtins {
create("java") {
option("lite")
}
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
```
And in build.gradle project level:
```
plugins {
//...
id("com.google.protobuf") version "0.9.5" apply false
}
```
The rest remains the same.
Contributor guide
Research direction
Reproduce the codelab's Proto DataStore setup from the linked step using Gradle 8.11.1 and the Kotlin Gradle plugin. Inspect the app build.gradle and project-level build.gradle entries shown in the issue, then verify that Gradle sync and the proto generation task complete without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100