Protobuf is a new structured data storage format developed by Google, which is generally used for serialization of structured data, which is what we often call data serialization. This serialization protocol is very light and efficient, and it is cross-platform. Currently, it supports a variety of mainstream languages and has more advantages than traditional XML, JSON and other methods. For details, please refer to: Google protocol buffer . However, recently when using Protobuf, the following error was reported.

 Execution failed for task ':columbus:generateDebugProto'.
> Could not resolve all files for configuration ':columbus:protobufToolsLocator_protoc'.
   > Could not find protoc-3.0.0-osx-aarch_64.exe (com.google.protobuf:protoc:3.0.0).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.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

The solution is to change the address of protoc. If we open https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-osx-aarch_64.exe directly, we will find that the webpage cannot be opened, so I will remove the version number and open the following link:

 https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/

The version of protoc obtained is as follows:
在这里插入图片描述
So, we just need to find the code below and add osx-x86_64 to com.google.protobuf:protoc:3.0.0 .

 protoc {
        artifact = 'com.google.protobuf:protoc:3.0.0'
    }
    plugins {
        javalite {
            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
        }
    }

//变更后
protoc {
        artifact = 'com.google.protobuf:protoc:3.0.0:osx-x86_64'
    }
    plugins {
        javalite {
            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0:osx-x86_64'
        }
    }

xiangzhihong
5.9k 声望15.3k 粉丝

著有《React Native移动开发实战》1,2,3、《Kotlin入门与实战》《Weex跨平台开发实战》、《Flutter跨平台开发与实战》1,2、《Android应用开发实战》和《鸿蒙HarmonyOS应用开发实践》