我正在构建一个 Kotlin/JS 项目,它将用作 Web 应用程序的库。kotlin 插件最近启用了 DCE 并提供了 keep 指令,但它没有保留我指定的类。
kotlin.target.browser {
dceTask {
keep 'BluetoothSerialJs.com.fivestars.bluetooth.BluetoothSerial'
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的类定义的顶部:
package com.fivestars.bluetooth
object BluetoothSerial {
Run Code Online (Sandbox Code Playgroud)
完整的项目在这里:
我需要使用 keep 定义指定根项目名称:
CordovoaAlternativePattern 是根项目名称。根项目名称通常位于settings.gradle
所以语法需要是:
RootProjectName-ModuleName.namespace.Class
Run Code Online (Sandbox Code Playgroud)
完整示例:
kotlin.target.browser {
dceTask {
keep 'CordovaAlternativePattern-BluetoothSerialJs.com.fivestars.bluetooth.BluetoothSerial'
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
263 次 |
| 最近记录: |