关于android:关于MAC-M1处理器运行Android-protoc报错的解决方案

5次阅读

共计 1237 个字符,预计需要花费 4 分钟才能阅读完成。

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.exe

Possible 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'}
    }
正文完
 0