解决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'
     }
 }
相关推荐
用户2018792831673 小时前
如何利用AI工具快速学习Android源码
android
音视频牛哥4 小时前
Android 平台RTSP/RTMP播放器SDK接入说明
android·音视频·大牛直播sdk·rtsp播放器·rtmp播放器·rtmp低延迟播放·rtmpplayer
st紫月4 小时前
用虚拟机安装macos系统之后进入Boot Manager页面
macos
aningxiaoxixi5 小时前
Android Framework 之 AudioDeviceBroker
android·windows·ffmpeg
~Yogi5 小时前
今日学习:工程问题(场景题)
android·学习
奔跑吧 android5 小时前
【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】
android·bluetooth·bt·aosp13
移动开发者1号5 小时前
Android Activity状态保存方法
android·kotlin
移动开发者1号5 小时前
Volley源码深度分析与设计亮点
android·kotlin
张风捷特烈5 小时前
每日一题 Flutter#7,8 | 关于 State 两道简答题
android·flutter·面试
tonngw11 小时前
【Mac 从 0 到 1 保姆级配置教程 16】- Docker 快速安装配置、常用命令以及实际项目演示
macos·docker·容器·开源·github·docker desktop·orbstack