Hey guys, quick question: Im getting a networkOnMa...
# ktor
s
Hey guys, quick question: Im getting a networkOnMainThread error when I do client.close().. what's the best way to close the client?
👀 1
e
What version of ktor do you use?
s
1.2.2
doesn't make much sense because I just replaced okhttp with android and the error doesnt occur
e
Could you throw the client.close() inside a withContext to make sure it gets closed off the main thread?
s
it's a multiplatform library. I have all my code inside a try catch and i'm closing it in the finally block. This code runs in a coroutine so I don't know what is causing this issue
And why the Android client doesn't have any issue but okhttp fails
e
Where are you starting the coroutine? Where is the try catch?
s
The try catch finally is inside a suspend function