解决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'
     }
 }
相关推荐
q***71852 小时前
MySQL--》如何在MySQL中打造高效优化索引
android·mysql·adb
IT痴者4 小时前
《PerfettoSQL 的通用查询模板》---Android-trace
android·开发语言·python
ai_xiaogui4 小时前
Mac苹果版Krita AI一键安装教程:AIStarter+ComfyUI零基础部署全流程(X86/ARM双架构)
arm开发·人工智能·macos·comfyui·一键部署·ai绘画教程·kritaai
游戏开发爱好者84 小时前
iOS IPA 上传工具全面解析,从 Transporter 到开心上架(Appuploader)命令行的高效上架实践
android·ios·小程序·https·uni-app·iphone·webview
alexhilton6 小时前
Jetpack Compose中的阴影艺术
android·kotlin·android jetpack
百***61879 小时前
Spring的构造注入
android·java·spring
Tom4i9 小时前
Kotlin 中的 inline 和 reified 关键字
android·开发语言·kotlin
yi诺千金10 小时前
Android U 自由窗口(浮窗)——启动流程(system_server侧流程)
android
清空mega12 小时前
第11章 网络编程
android·网络
自动化BUG制造器12 小时前
Android UI 线程不一定是主线程
android