
Protoc problem with M1 chip
Problem
when trying to run the project this error appears:
Could not find protoc-gen-javalite-3.0.0-osx-aarch_64.exe (com.google.protobuf:protoc-gen-javalite:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/google/protobuf/protoc-gen-javalite/3.0.0/protoc-gen-javalite-3.0.0-osx-aarch_64.exe
Cause
this is because protoc doesn’t support m1 yet
Solution
1- Create file at: $HOME/.gradle/gradle.properties
with the following:
protoc_platform=osx-x86_64
2- Modify android build.gradle to:
protobuf {
// Configure the protoc executable
protoc {
if (project.hasProperty('protoc_platform')) {
artifact = "com.google.protobuf:protoc:3.11.2:${protoc_platform}"
} else {
artifact = "com.google.protobuf:protoc:3.11.2"
}
}
plugins {
javalite {
// The codegen for lite comes as a separate artifact
if (project.hasProperty('protoc_platform')) {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0:${protoc_platform}"
} else {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
}
}
}
5 Comments