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

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'
        }
    }

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理