Seeking Guidance on Custom Android Build with WebView Integration

69 views
Skip to first unread message

邓纪富

unread,
Apr 9, 2025, 8:24:26 PMApr 9
to android-webview-dev

Dear AOSP WebView Team,

I hope this message finds you well. My name is [Your Name], and I'm an independent developer currently working on a customized Android build for personal use on my Google Pixel 3 device.

I've encountered some challenges after building and flashing AOSP android11_r34:

  1. The system appears to have no functional WebView implementation
  2. Installed browsers fail to access the network (crashing on launch)

From my research, I understand that Android stopped bundling WebView since Lollipop, requiring developers to integrate it manually. I've attempted:

  • Placing a Google WebView APK in external/chromium-webview/prebuilt/arm64 before rebuilding
  • Testing both my custom AOSP build and the official factory image (noting behavioral differences)

Unfortunately, these approaches haven't resolved the issues. I'd greatly appreciate any insights on:

  • The proper method to integrate WebView in custom AOSP builds
  • Potential differences between factory images and clean AOSP builds regarding WebView handling
  • Recommended debugging steps for the browser crashes

Thank you very much for your time and expertise. The work you do on AOSP is incredibly valuable to developers like myself. Please let me know if you need any additional details about my setup.

Best regards,

Nate Fischer

unread,
Apr 9, 2025, 8:31:54 PMApr 9
to 邓纪富, android-webview-dev
Hi, thanks for reaching out!

> Installed browsers fail to access the network (crashing on launch)

Can you share the crash stack from adb logcat?

Also, can you run `adb shell dumpsys webviewupdate` and share the output here?

> From my research, I understand that Android stopped bundling WebView since Lollipop, requiring developers to integrate it manually.

You are half right. Starting in Android Lollipop, WebView code was refactored out of the operating system itself into a separate updatable APK file. But we still include that APK file in the Android source code repository, and the WebView APK file should be installed by default if you flash your device. If all you did was flash a device, then it is highly unlikely that you are missing a WebView implementation. It should come along automatically when you flash.

Now if you do want to modify your own WebView, that is something we support (for development purposes). The steps for that are https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/aosp-system-integration.md. But to be clear, we do not expect that everyone has to do this just to make the device work. This is only necessary if you want to make your own customizations to WebView.

Nate Fischer | Software Engineer | ntf...@google.com



--
You received this message because you are subscribed to the Google Groups "android-webview-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-webview...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/android-webview-dev/8f0324f6-2608-4dc3-acc5-15a6fa2a6ceen%40chromium.org.

Torne (Richard Coles)

unread,
Apr 11, 2025, 12:25:11 PMApr 11
to Nate Fischer, 邓纪富, android-webview-dev
On Wed, 9 Apr 2025 at 20:31, 'Nate Fischer' via android-webview-dev <android-w...@chromium.org> wrote:
Hi, thanks for reaching out!

> Installed browsers fail to access the network (crashing on launch)

Can you share the crash stack from adb logcat?

Also, can you run `adb shell dumpsys webviewupdate` and share the output here?

Yeah, that is the most important debugging step - I suspect that the device is still configured to use the Google-branded WebView. `adb shell dumpsys webviewupdate` shows the entire configuration and current state, so we can check.
 
> From my research, I understand that Android stopped bundling WebView since Lollipop, requiring developers to integrate it manually.

You are half right. Starting in Android Lollipop, WebView code was refactored out of the operating system itself into a separate updatable APK file. But we still include that APK file in the Android source code repository, and the WebView APK file should be installed by default if you flash your device. If all you did was flash a device, then it is highly unlikely that you are missing a WebView implementation. It should come along automatically when you flash.

Now if you do want to modify your own WebView, that is something we support (for development purposes). The steps for that are https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/aosp-system-integration.md. But to be clear, we do not expect that everyone has to do this just to make the device work. This is only necessary if you want to make your own customizations to WebView.

Nate is correct here, but I think there may be an additional complication with some methods of building and flashing Android that don't apply to OEMs building their own devices.

Modern Android devices have multiple read-only partitions that all contribute parts of the OS, primarily "system", "vendor", and "product". When building a device "from scratch" the Android build will include all of these partitions and flashing will replace all of them, but to build a custom ROM for an existing device it's often the case that the product and/or vendor partitions contain non-open-source code/data that can't be built from the AOSP tree alone.

If you are relying on flashing only some of the partitions, or on copying data from the existing versions of those partitions into your build, it's possible to end up in a state where the WebView-related parts in different partitions aren't consistent. There are several moving parts here:

1. The actual WebView APK. This might be installed on any partition (depends on the device/ROM configuration), and there can be more than one with different package names (on the same or different partitions).
2. The "built-in" configuration for which WebView implementation to use. This is the `config_webview_packages.xml` file that gets compiled into the framework's resources and becomes part of `/system/framework/framework-res.apk`. The default version of this configuration only uses `com.android.webview` as a WebView implementation, but you can modify the source file at build time to change it to anything you wish.
3. Zero or more framework resource overlays. Devices can include a number of overlays that replace specific resources with new versions, and it's common for there to be some of these on the vendor or product partitions.

Devices that ship with the Google-branded WebView (`com.google.android.webview`) usually configure this using a resource overlay, not by actually changing the "built-in" version of the resource: the configuration in `/system/framework/framework-res.apk` is not used, because it's been replaced by the version in the overlay (which may be found at `/product/overlay/GoogleWebViewOverlay.apk` on most devices, but might be on a different partition or have a different name).

So, you may find that the custom ROM you have built contains your own version of WebView on the system partition as "com.android.webview", but the device might still have an overlay on the product or vendor partitions which is configuring it to look for "com.google.android.webview" instead.

Our documentation assumes that you are the OEM building the entire device firmware at once, and that you are in control of all the configuration/overlays that are being used.
 

Nate Fischer | Software Engineer | ntf...@google.com



On Wed, Apr 9, 2025 at 5:24 PM 邓纪富 <deng...@gmail.com> wrote:

Dear AOSP WebView Team,

I hope this message finds you well. My name is [Your Name], and I'm an independent developer currently working on a customized Android build for personal use on my Google Pixel 3 device.

I've encountered some challenges after building and flashing AOSP android11_r34:

  1. The system appears to have no functional WebView implementation
  2. Installed browsers fail to access the network (crashing on launch)

From my research, I understand that Android stopped bundling WebView since Lollipop, requiring developers to integrate it manually. I've attempted:

  • Placing a Google WebView APK in external/chromium-webview/prebuilt/arm64 before rebuilding
  • Testing both my custom AOSP build and the official factory image (noting behavioral differences)

Unfortunately, these approaches haven't resolved the issues. I'd greatly appreciate any insights on:

  • The proper method to integrate WebView in custom AOSP builds
  • Potential differences between factory images and clean AOSP builds regarding WebView handling
  • Recommended debugging steps for the browser crashes

Thank you very much for your time and expertise. The work you do on AOSP is incredibly valuable to developers like myself. Please let me know if you need any additional details about my setup.

Best regards,

--
You received this message because you are subscribed to the Google Groups "android-webview-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-webview...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/android-webview-dev/8f0324f6-2608-4dc3-acc5-15a6fa2a6ceen%40chromium.org.

--
You received this message because you are subscribed to the Google Groups "android-webview-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-webview...@chromium.org.
Reply all
Reply to author
Forward
0 new messages