如果我包含 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
最佳答案
我在使用 kotlin reflect class 和 proguard 时遇到了一些类似的错误,解决了添加 -optimizations
!class/拆箱/枚举
我的错误与此有关 Android Proguard failing with "Value 'i' is not a reference value"
并在其中一条评论中找到了修复
关于Android 构建因 kotlin-reflect 和 proguard 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42817993/