When using webview
, I found that the response of the app was very slow when starting the fragment with webview for the first time, but it was not equally slow when it was started again
05-05 20:57:18.721 I/WebViewFactory: Loading com.google.android.webview version 51.0.2704.81 (code 270408150)
05-05 20:57:18.897 W/System: ClassLoader referenced unknown path: /system/app/WebViewGoogle/lib/arm64
05-05 20:57:18.919 I/cr_LibraryLoader: Time to load native libraries: 14 ms (timestamps 7291-7305)
05-05 20:57:18.919 I/cr_LibraryLoader: Expected native library version number "51.0.2704.81", actual native library version number "51.0.2704.81"
05-05 20:57:18.939 V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {20922c4}
05-05 20:57:18.940 I/cr_LibraryLoader: Expected native library version number "51.0.2704.81", actual native library version number "51.0.2704.81"
05-05 20:57:18.941 I/chromium: [INFO:library_loader_hooks.cc(143)] Chromium logging enabled: level = 0, default verbosity = 0
05-05 20:57:19.015 I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
05-05 20:57:19.153 E/ActivityThread: Failed to find provider info for com.google.settings
05-05 20:57:19.197 D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
05-05 20:57:19.210 W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
05-05 20:57:19.211 D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
05-05 20:57:19.217 D/EgretLoader: EgretLoader(Context context)
05-05 20:57:19.224 D/EgretLoader: The context is not activity
Viewlogcat
It is found that the above operations are only performed when loading for the first time. Is there any way to improve the response speed of opening the webview for the first time?
Webview is also a browser, it needs to download files, and it will be faster with the cache later.
Optimization is nothing more than on-demand loading, compression and the like. Optimizations that can be used in basic browsers can be used here as well.
You can pre-enable webview and set the height and width of 1 pixel, and preload many static resources. Many domestic apps do this, and the user experience is very good.