Could not get unknown property 'source' for generate-proto-generateDebugProto of type

Open Beginner friendly
#81 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
kotlin
Domain
build-system

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.

Description

These are 2 errors that I've faced on Working with Proto DataStore:
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.

Dominant language
Kotlin
Stars
240
Forks
113
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/codelab-android-datastore

All issues in android/codelab-android-datastore

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.