cronet-transport-for-okhttp
cronet-transport-for-okhttp copied to clipboard
ANRs when loading Cronet Provider
Sharing some of the ANRs encountered when calling CronetProviderInstaller
and when calling build
method of CronetEngine.Builder
and CronetInterceptor
There is one ANR happening due to System.loadLibrary
being called on main thread by Play Services.
Is it safe to call the CronetProviderInstaller.installProvider()
on a background thread?
Hi @adityameesho,
Initializing Cronet can be fairly expensive as it involves loading a non-trivial amount of Java code as well as the native library (which requires its own initialization as well). For this reason, it might indeed be a good idea to do it in a background thread to avoid blocking the UI on the loading process, which could potentially result in ANRs especially if the device is slow or starved of resources (e.g. during app startup).