Hi got this compile error when upgrading from okHttp version 3 to version 4:
val JSON = MediaType.parse("application/json; charset=utf-8")
//Compile Error: Kotlin: Using 'parse(String): MediaType?' is an error. moved to extension function
I changed the call to invoke the extension method as the error points but the method is not recognizes as an String extension.
Here is how i did changed it:
val JSON = "application/json; charset=utf-8".toMediaType()
Adding the import for Companion Objects as posted in tutorial also didn't solve it:
import okhttp3.CipherSuite.Companion.forJavaName
What did i miss here?
import okhttp3.MediaType.Companion.toMediaType
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With