WebView Activity crashes on missing Chrome package

Viewed 471

My app has been working fine for several years on the Play Store. The main activity's layout XML contains a WebView. Recently, the app has begun to crash at launch time (but not always, and not on every device).

The Logcat shows a RuntimeException on WebViewFactory about Package not found: com.android.chrome.

I don't explicitly use this system class. The crash occurs whether the WebView is part of the XML layout, or instantiated programmatically. No try/catch will help.

06-26 18:22:52.560  1363  1409 I ActivityManager: Displayed com.my.app/.MyActivity: +46ms
06-26 18:22:52.829  1363  6524 D ActivityManager: # addPackageDependency # packageName=com.android.chrome -> proc: ProcessRecord{e72ceb3 9789:com.my.app/u0a214}
06-26 18:22:52.839  9789  9789 I WebViewFactory: Loading com.android.chrome version 75.0.3770.101 (code 377010137)
--------- beginning of crash
06-26 18:22:52.903  9789 10122 E AndroidRuntime: FATAL EXCEPTION: Thread-2
06-26 18:22:52.903  9789 10122 E AndroidRuntime: Process: com.my.app, PID: 9789
06-26 18:22:52.903  9789 10122 E AndroidRuntime: java.lang.RuntimeException: Package not found: com.android.chrome
06-26 18:22:52.903  9789 10122 E AndroidRuntime:        at android.webkit.WebViewDelegate.getPackageId(WebViewDelegate.java:164)
06-26 18:22:52.903  9789 10122 E AndroidRuntime:        at xZ.a(PG:16)
06-26 18:22:52.903  9789 10122 E AndroidRuntime:        at xq.run(PG:14)
06-26 18:22:52.903  9789 10122 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
06-26 18:22:52.908  9789  9789 I cr_LibraryLoader: Time to load native libraries: 3 ms (timestamps 7584-7587)
06-26 18:22:52.909  9789 10123 D OSTracker: OS Event: crash
06-26 18:22:52.844  1363  6524 D ActivityManager: # addPackageDependency # packageName=com.android.chrome -> proc: ProcessRecord{e72ceb3 9789:com.my.app/u0a214}
06-26 18:22:52.911  1363  3290 W ActivityManager:   Force finishing activity com.my.app/.MyActivity

(I replaced my package name with com.my.app in the above log, for clarity.)

None of these lines are my own Log strings. It's all system's.

The crashing device do have the Chrome APK installed, and the WebView implementation is defined to be Chrome.

It seems to me that, at the time of app launch, the com.android.chrome dependency is not yet ready, and the system fails to load and bind it to my process.

Is there a way to force preloading the dependency?

Thanks.

0 Answers
Related