Our App is doing Network Requests in Application::onCreate
. Starting with Android 15 these requests fail with either UnknownHostException
or GaiException
. On lower Android versions it works. I can reproduce it using the following code:
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
CoroutineScope(Dispatchers.IO).launch {
InetAddress.getByName("google.com")
}
}
}
InetAddress.getByName
is just an example, any request fails. Permissions are set correctly in the manifest. Do you know why this happens? Or do you know when it is safe to do network requests? When I add a delay of a few seconds, it works.
There is a similar issue here, but unfortunately no answer.
Source: View source