Aleksey Chugaev
12/18/2019, 9:16 PMTrying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
kotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
kfun:kotlin.Throwable.<init>(kotlin.String?)kotlin.Throwable + 87
kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 85
kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 85
kfun:kotlin.native.IncorrectDereferenceException.<init>(kotlin.String)kotlin.native.IncorrectDereferenceException + 85
ThrowIncorrectDereferenceException + 137
CheckIsMainThread + 25
kfun:io.ktor.http.<get-URL_ALPHABET_CHARS>#internal + 35
kfun:io.ktor.http.encodeURLPath@kotlin.String.()kotlin.String + 717
kfun:io.ktor.http.takeFromUnsafe$ktor-http@io.ktor.http.URLBuilder.(kotlin.String)io.ktor.http.URLBuilder + 2278
kfun:io.ktor.http.takeFrom@io.ktor.http.URLBuilder.(kotlin.String)io.ktor.http.URLBuilder + 263
My code is
...
withContext(workerDispatcher){
val loginResponse = <http://client.post|client.post><LoginNetworkResponse>("$apiEndpoint/init/auth?v=1") {
contentType(ContentType.Application.Json)
body = LoginNetworkRequest(
...
)
}
....
}
cy
12/18/2019, 9:24 PMAleksey Chugaev
12/18/2019, 9:39 PMcy
12/18/2019, 9:41 PMAleksey Chugaev
12/18/2019, 9:43 PMcy
12/18/2019, 10:01 PMAleksey Chugaev
12/18/2019, 10:06 PM