Relative Content

Tag Archive for androidkotlinokhttp

Android – okhttp NullPointerException on Cookie.name()

Lately I started getting an exception in production, where the app complains about a NullPointerException when trying to access an okhttp’s Cookie instance. We can’t reproduce it, and it’s quite confusing as not only the code is in Kotlin, using non nullable types, but cookies are mainly managed by okhttp.

Android – okhttp NullPointerException on Cookie.name()

Lately I started getting an exception in production, where the app complains about a NullPointerException when trying to access an okhttp’s Cookie instance. We can’t reproduce it, and it’s quite confusing as not only the code is in Kotlin, using non nullable types, but cookies are mainly managed by okhttp.

Okhttp3 post function won’t accept FormBody as argument

Using Okhttp3 4.12.0 in Android Studio (2023.2.1 Patch 1) with Kotlin, I’m attempting to post a FormBody but the post function from Request.Builder() won’t accept FormBody as an argument since it requires a RequestBody, even though the former extends the latter.