How to convert ByteArray to String with specified encoding in Kotlin

I found that there is a ByteArray.toString (charset: Charset) function in Kotlin , when I use this function in android studio IDE it gets syntax error. But I tried the same code on the Kotlin org site, it works well. How to convert ByteArray to String in Kotlin?

Android Studio error message

+3


source to share


1 answer


It seems that you have not configured your project for Kotlin (there is no kotlin-runtime.jar in your classpath). Try to select the line with error, click Alt+Enter

and from the context menu select "Kotlin is not configured" → "Configure", Or manually add kotlin-runtime.jar to your classpath



enter image description here

+1


source







All Articles