I am working on a project where I need to utilize a customized WebView. I have setup a test environment using a Android 7.0 code base. I followed the instructions (
https://www.chromium.org/developers/how-tos/build-instructions-android-webview) and built a system webview APK. To make sure the WebView works fine, I tested some webpages inside an app using WebView. The web pages load fine, but I observe an issue when I have to fill web page forms (containing <input> fields) inside the WebView. When I click on an <input> field, the keyboard doesn't show up. I describe below the steps I followed to setup the test environment and some observations I have.
How test environment was setup:I did the environment setup using instructions spread across the links:
https://www.chromium.org/developers/how-tos/build-instructions-android-webview https://www.chromium.org/developers/how-tos/android-build-instructionshttps://www.chromium.org/developers/gn-build-configurationhttps://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.mdSteps were as as follows:
- Downloaded chromium source using (download date - Feb 14): fetch --nohooks android
- gclient runhooks
- gn args out/Default (set arguments as in instructions)
- src/build/install-build-deps-android.sh
- gclient sync
- . build/android/envsetup.sh
- gn gen out/Release --args='target_os="android"'
- Modified out/Release/args.gn to add : target_cpu = "arm64"
- ninja -C out/Release system_webview_apk
The above steps generated SystemWebView.apk.
How APK was installed on Android device:The existing app (com.android.webview) on the device was a system app, so adb uninstall didn't work. Not sure whether system app would be a necessity, I signed the new SystemWebView.apk using my AOSP source's platform key. I then followed these steps:
- adb root
- adb remount
- adb shell stop
- adb shell rm -rf /system/app/webview
- adb shell start
- adb install -r -d SystemWebView.apk
Other observations related to environment setup:- For some reason, once I finish installing the new APK, the libwebviewchromium32.relro and libwebviewchromium64.relro files in /data/misc/shared_relro/ get deleted. To do the test, I had to adb push them.
- The native library (.so) name is different from what I expected. I checked the original webview.apk on device, and its lib folder had the library name libwebviewchromium.so, but the new APK has the name libwebviewchromium.cr.so. I'm not sure if this can cause an issue, but I do observe an inconsistency because the AndroidManifest.xml of the APK generated from chromium contains the following entry:
<meta-data android:name="com.android.webview.WebViewLibrary" android:value="libwebviewchromium.so"/>