zt
08/11/2022, 7:34 PM<https://youtube.com>
but not when I make a request to another URL such as <https://github.com>
On an actual phone this crash doesn't happen.
The code im using is this in my MainActivity
HttpClient(CIO).get("<https://youtube.com/>")
The crash
Caused by: java.net.SocketException: Network is unreachable
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:762)
at io.ktor.network.sockets.SocketImpl.connect$ktor_network(SocketImpl.kt:50)
at io.ktor.network.sockets.SocketImpl$connect$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Aleksei Tirman [JB]
08/12/2022, 4:16 PMzt
08/12/2022, 4:17 PMAleksei Tirman [JB]
08/12/2022, 4:18 PMzt
08/12/2022, 4:18 PMzt
08/12/2022, 4:40 PMval connection = URL("<https://www.youtube.com>").openConnection() as HttpURLConnection
val body = connection.inputStream.bufferedReader().readText()
Aleksei Tirman [JB]
08/12/2022, 4:46 PMzt
08/12/2022, 4:47 PMAleksei Tirman [JB]
08/12/2022, 4:48 PMzt
08/12/2022, 5:33 PM