Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANRs when loading Cronet Provider #28

Open
adityameesho opened this issue Aug 16, 2023 · 1 comment
Open

ANRs when loading Cronet Provider #28

adityameesho opened this issue Aug 16, 2023 · 1 comment

Comments

@adityameesho
Copy link

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?

anr_load_library.txt
anr1.txt
anr2.txt
anr3.txt

@edechamps-Google
Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants