When trying to run the Jetpack DataStore Proto codelab, I am not able to build the app as instructed on page 6. Instead I get the following error:
Execution failed for task ':app:generateDebugProto'.
> Could not resolve all files for configuration ':app:protobufToolsLocator_protoc'.
> Could not find protoc-3.14.0-osx-aarch_64.exe (com.google.protobuf:protoc:3.14.0).
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.14.0/protoc-3.14.0-osx-aarch_64.exe
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Fix
Starting with version 3.17.3, protoc added support for M1 Macs.
The documentation on page 5 needs to be udpated to use protoc with at least v3.17.3 instead of 3.14.0.
The current stable version is 3.19.1:
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.19.1"
}
// Generates the java Protobuf-lite code for the Protobufs in this project. See
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
// for more information.
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite'
}
}
}
}
}
When trying to run the Jetpack DataStore Proto codelab, I am not able to build the app as instructed on page 6. Instead I get the following error:
Fix
Starting with version 3.17.3, protoc added support for M1 Macs. The documentation on page 5 needs to be udpated to use protoc with at least v
3.17.3
instead of3.14.0
. The current stable version is 3.19.1: