Android 12
I am trying to secure username and password before sending it over the internet to the server. However, I need to convert my strings into HEX and I keep getting HexFormat: unresolved reference error. There seems to be no class or library associated with that. How do I solve this error? Is there a library I need to download and install?
Unresolved Reference: HexFormat
private fun ByteArray.toHexString(): String = HexFormat.of().formatHex(this)
/|\
|
|
|
edit:
Android 12
I am trying to secure username and password before sending it over the internet to the server. However, I need to convert my strings into HEX and I keep getting HexFormat: unresolved reference error. There seems to be no class or library associated with that. How do I solve this error? Is there a library I need to download and install?
Unresolved Reference: HexFormat
private fun ByteArray.toHexString(): String = HexFormat.of().formatHex(this)
/|\
|
|
|
edit:
Share Improve this question edited Jan 17 at 17:35 ThN asked Jan 17 at 17:12 ThNThN 3,2745 gold badges64 silver badges120 bronze badges 1 |2 Answers
Reset to default 1HexFormat was add in API 34, Android 12 is API 31 so you wont be able to use it in anything below Android 14
use ByteArray.toHexString(format: HexFormat = HexFormat.Default)
.
package kotlin.text
@SinceKotlin("1.9")
import java.util.HexFormat
? – tyczj Commented Jan 17 at 17:15