can’t find referenced class kotlin.KotlinPackage Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of can’t find referenced class kotlin.KotlinPackage without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I’ve tried adding “-dontwarn kotlin.KotlinPackage” to proguard-rules.pro but not working. I’m using Base64 in my code and i can’t find where is wrong. When i disable minify, there is no problem.

Warning

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

My code

val decoded_note = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        Base64.getDecoder().decode(LocalData.with(this@MainActivity.applicationContext).read(getString(R.string.hashed_note)).toByteArray(Charsets.UTF_8))
    } else {
        android.util.Base64.decode(LocalData.with(this@MainActivity.applicationContext).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(this@MainActivity.applicationContext).write(getString(R.string.hashed_note),hashed_note.toString())
    }
}

Answer

I’ve solved my problem with cleaning up the project. Build–>Clean Build

We are here to answer your question about can’t find referenced class kotlin.KotlinPackage - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji