解决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'
     }
 }
相关推荐
唔662 分钟前
出厂前一次性授权
android
崇山峻岭之间30 分钟前
Matlab学习记录12
android·学习·matlab
jllllyuz1 小时前
C# 面向对象图书管理系统
android·开发语言·c#
灵感菇_1 小时前
Android图片加载框架 Glide全面解析
android·缓存·glide
、BeYourself2 小时前
Android 开发:交错网格、卡片视图与 RecyclerView 实战
android·android-studio
apihz2 小时前
免费手机号归属地查询API接口详细教程
android·java·运维·服务器·开发语言
容华谢后2 小时前
Android基于共享内存实现跨进程大文件传输
android
Kapaseker2 小时前
面试官最爱问的 Android 数据传递问题
android·kotlin
xincan08182 小时前
MacOS安装Java+mvn+mvnd+jenv多环境丝滑切换
java·开发语言·macos
斌将军2 小时前
如何在MAC的eclipse中根据win11虚拟机的SAPGUI登录配置创建ABAP project
macos·eclipse