【问题标题】:Is it safe to ignore these proguard notes for kotlin?忽略这些 kotlin 的 proguard 注释是否安全?
【发布时间】:2018-10-07 14:45:29
【问题描述】:

我不明白为什么我会从 proguard 那里收到这些笔记,以及我是否必须采取任何措施来解决这些问题。

Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class 
kotlin.internal.jdk8.JDK8PlatformImplementations 
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class 
kotlin.internal.JRE8PlatformImplementations 
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class 
kotlin.internal.JRE7PlatformImplementations 

Note: kotlin.jvm.internal.Reflection: can't find dynamically referenced class 
kotlin.reflect.jvm.internal.ReflectionFactoryImpl

其中三个用于kotlin.internal.PlatformImplementationKt,一个用于kotlin.jvm.internal.Reflection

我的设置

kotlin: 1.2.71
Android Studio / gradle plugin: 3.2.0
gradle: 4.10.2

【问题讨论】:

    标签: android kotlin proguard


    【解决方案1】:

    是的,它是安全的,您应该将这些规则添加到您的 proguard-rules.pro 配置中

    # Kotlin
    -keep class kotlin.Metadata { *; }
    -dontnote kotlin.internal.PlatformImplementationsKt
    -dontnote kotlin.reflect.jvm.internal.**
    

    【讨论】:

    • 好的。我对为什么 proguard 提供can't find dynamically referenced class 注释有了大致的了解。知道为什么我们会收到这些针对 kotlin 的特定注释吗?
    • 这可能取决于 Kotlin 的工作方式,可能它正在尝试使用可用的实现检查它运行的 JVM 版本(我根据您发布的消息推测)。此警告应该是 Android Studio proguard 内部实现的一部分,因此可能有一天您不再需要它们(过去发生过很多次)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-10-24
    • 1970-01-01
    • 2016-08-10
    • 2020-12-04
    • 2012-02-02
    • 2015-09-16
    • 1970-01-01
    相关资源
    最近更新 更多