找不到引用类kotlin.KotlinPackage

问题描述 投票:0回答:1

我尝试将“-dontwarn kotlin.KotlinPackage”添加到proguard-rules.pro但不起作用。我在我的代码中使用Base64,我找不到哪里出错了。当我禁用minify时,没有问题。

警告

Warning: Base64Kt: can't find referenced class kotlin.KotlinPackage

我的代码

val decoded_note = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        Base64.getDecoder().decode(LocalData.with([email protected]).read(getString(R.string.hashed_note)).toByteArray(Charsets.UTF_8))
    } else {
        android.util.Base64.decode(LocalData.with([email protected]).read(getString(R.string.hashed_note)).toByteArray(Charsets.UTF_8), android.util.Base64.DEFAULT)
    }
    val old_note = String(decoded_note, charset("UTF-8"))
    note_EditText.setText(old_note)

    note_save_button.setOnClickListener{
        val new_note=note_EditText.text.toString()

        val hashed_note= if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            Base64.getEncoder().encodeToString(new_note.toByteArray(charset("UTF-8")))
        } else {
            android.util.Base64.encodeToString(new_note.toByteArray(charset("UTF-8")), android.util.Base64.DEFAULT)
        }

        LocalData.with([email protected]).write(getString(R.string.hashed_note),hashed_note.toString())
    }
}
android kotlin base64 proguard
1个回答
0
投票

我已经解决了清理项目的问题。构建 - >清洁构建

© www.soinside.com 2019 - 2024. All rights reserved.