首页
学习
活动
专区
圈层
工具
发布

和R8
EN

Stack Overflow用户
提问于 2020-07-27 16:25:22
回答 1查看 773关注 0票数 0

我的发行版构建在以下任务上失败:minifyReleaseWithR8 8

代码语言:javascript
复制
> Task :app:minifyReleaseWithR8 FAILED
AGPBI: {"kind":"error","text":"Type com.google.protobuf.SourceContextOrBuilder is defined multiple times: /Users/userz/.gradle/caches/transforms-2/files-2.1/fa3559cc4d07efe76175d461f7267b38/jetified-protobuf-javalite-3.11.0.jar:com/google/protobuf/SourceContextOrBuilder.class, /Users/userz/path-to-project/build/intermediates/javac/release/classes/com/google/protobuf/SourceContextOrBuilder.class","sources":[{"file":"/Users/userz/.gradle/caches/transforms-2/files-2.1/fa3559cc4d07efe76175d461f7267b38/jetified-protobuf-javalite-3.11.0.jar"}],"tool":"R8"}

项目中的protobuf定义如下:

代码语言:javascript
复制
protobuf {
    protoc {
        // You still need protoc like in the non-Android case
        artifact = "com.google.protobuf:protoc:3.11.0"
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

protobuf "com.google.protobuf:protobuf-javalite:3.11.0"

有趣的是如果我删除firebase性能库

代码语言:javascript
复制
implementation "com.google.firebase:firebase-perf"

比前面的构建失败(on :kaptReleaseKotlin任务)

代码语言:javascript
复制
> Task :app:kaptReleaseKotlin
path-to-project/build/generated/source/proto/release/java/main/MessageOuterClass.java:9: error: cannot find symbol
      com.google.protobuf.ExtensionRegistryLite registry) {  
symbol:   class ExtensionRegistryLite
  location: package com.google.protobuf/path-to-project/build/generated/source/proto/release/java/main/MessageOuterClass.java:493: error: cannot find symbol
      com.google.protobuf.MessageLiteOrBuilder {
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-29 13:11:51

代码语言:javascript
复制
implementation "com.google.protobuf:protobuf-javalite:3.11.0"

解决了这个问题

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63119435

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档