Protobuf是Google開發(fā)的一種新的結(jié)構(gòu)化數(shù)據(jù)存儲格式,一般用于結(jié)構(gòu)化數(shù)據(jù)的序列化,也就是我們常說的數(shù)據(jù)序列化。這個序列化協(xié)議非常輕量級和高效,并且是跨平臺的。目前,它支持多種主流語言,比傳統(tǒng)的XML、JSON等方法更具優(yōu)勢。詳細(xì)信息請參考: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的地址。
發(fā)現(xiàn)https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/
這個倉庫下就沒有protoc-3.0.0-osx-aarch_64.exe
這個文件
解決方案是修改協(xié)議地址。如果我們直接打開https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-osx-aarch_64.exe,我們會發(fā)現(xiàn)網(wǎng)頁無法打開,所以我將刪除版本號并打開以下鏈接:
因此,我們只需要找到下面的代碼com.google.protobuf:protoc:3.0.0
并將osx-x86_64
添加到文章來源:http://www.zghlxwxcb.cn/news/detail-633218.html
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
變更后文章來源地址http://www.zghlxwxcb.cn/news/detail-633218.html
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'
}
}
到了這里,關(guān)于解決MAC M1處理器運行Android protoc時出現(xiàn)的錯誤的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!