解决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/这个仓库下就没有protoc-3.0.0-osx-aarch_64.exe这个文件

解决方案是修改协议地址。如果我们直接打开https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-osx-aarch_64.exe,我们会发现网页无法打开,所以我将删除版本号并打开以下链接:

因此,我们只需要找到下面的代码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'
     }
 }
相关推荐
_祝你今天愉快1 小时前
Android FrameWork - 开机启动 & Init 进程 初探
android
2501_916007471 小时前
iOS App 上架实战 从内测到应用商店发布的全周期流程解析
android·ios·小程序·https·uni-app·iphone·webview
TimeFine2 小时前
Android 邮件发送日志
android
杨过过儿2 小时前
【Task02】:四步构建简单rag(第一章3节)
android·java·数据库
铁锚2 小时前
在MAC环境中安装unsloth
人工智能·python·macos·语言模型
Wgllss2 小时前
Kotlin 享元设计模式详解 和对象池及在内存优化中的几种案例和应用场景
android·架构·android jetpack
Faith-小浩浩3 小时前
macos 多个版本的jdk
java·macos·jdk
2501_928094654 小时前
OBS - Mac专业录屏工具(Mac中文)
macos·mac·录屏
大熊猫侯佩4 小时前
拒绝羡慕 Cursor!Xcode 自己也能利用 AI 大模型让撸码如虎添翼【超详细配置】
macos·ai编程·xcode