Protobuf是Google开发的一种新的结构化数据存储格局,个别用于结构化数据的串行化,即咱们常说的数据序列化。这种序列化的协定十分轻便高效,而且是跨平台的,目前已反对多种支流语言,并且比传统的XML, JSON等形式更具劣势。详情能够参考:Google protocol buffer。不过,最近在应用Protobuf时候报了如下的一个谬误。
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.exePossible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
解决的办法是更换protoc的地址,如果咱们间接关上https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-osx-aarch_64.exe
,会发现网页时打不开,所以我就去掉前面的版本号,关上上面的链接:
https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/
失去protoc的版本如下:
所以,咱们只须要找到上面的代码,在com.google.protobuf:protoc:3.0.0
中增加osx-x86_64即可。
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' } }