【问题标题】:Android build fails with kotlin-reflect and proguardAndroid 构建因 kotlin-reflect 和 proguard 而失败
【发布时间】:2017-03-15 18:32:34
【问题描述】:

如果我在其中包含kotlin-reflect,我将无法构建我的发布产品。我尝试将此添加到 proguard 配置中:

-keep class kotlin.reflect.** { *; }

但它根本没有帮助。这是 gradle 构建的错误结果:

Optimizing...
Unexpected error while performing partial evaluation:
   Class       = [kotlin/reflect/jvm/internal/impl/renderer/DescriptorRendererImpl]
   Method      = [renderPossiblyInnerType(Ljava/lang/StringBuilder;Lkotlin/reflect/jvm/internal/impl/descriptors/PossiblyInnerType;)V]
   Exception   = [java.lang.IllegalArgumentException] (Stacks have different current sizes [0] and [1])
 Warning: Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Stacks have different current sizes [0] and [1]

我正在使用 kotlin 1.1.1(和 gradle 3.3,如果这很重要的话。) j

【问题讨论】:

  • 您可能还需要保留成员及其姓名
  • 在 proguard 配置中使用 -dontoptimize

标签: android kotlin kotlin-reflect


【解决方案1】:

我在使用 kotlin reflect class 和 proguard 时遇到了一些类似的错误,解决了添加 -optimizations

!class/unboxing/枚举

我的错误与此Android Proguard failing with "Value 'i' is not a reference value" 有关 并在其中一个 cmets 中找到了修复程序

【讨论】:

    猜你喜欢
    • 2017-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-07
    • 1970-01-01
    • 2018-09-05
    相关资源
    最近更新 更多