Google is committed to advancing racial equity for Black communities. See how.

Webkit

Work with modern WebView APIs on Android 5 and above.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
November 11, 2020 1.3.0 1.4.0-rc01 - -

Declaring dependencies

To add a dependency on Webkit, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    implementation "androidx.webkit:webkit:1.3.0"
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.4.0

Webkit Version 1.4.0-rc01

November 11, 2020

androidx.webkit:webkit:1.4.0-rc01 is released with no changes since 1.4.0-beta01. Version 1.4.0-rc01 contains these commits.

Version 1.4.0-beta01

October 14, 2020

androidx.webkit:webkit:1.4.0-beta01 is released with no changes since 1.4.0-alpha01. Version 1.4.0-beta01 contains these commits.

Version 1.4.0-alpha01

September 16, 2020

androidx.webkit:webkit:1.4.0-alpha01 is released. Version 1.4.0-alpha01 contains these commits.

API Changes

  • Added a new WebViewCompat#setSafeBrowsingAllowlist() API to replace setSafeBrowsingWhitelist(). This helps apps update their code to avoid non-inclusive terminology, while still supporting the same range of Android SDKs and WebView versions as the deprecated API. (I8d65d)

Version 1.3.0

Version 1.3.0

August 19, 2020

androidx.webkit:webkit:1.3.0 is released. Version 1.3.0 contains these commits.

Major changes since 1.2.0

  • ForceDarkStrategy API provides more control to WebView darkening (CSS/web content darkening versus auto darkening).
  • WebMessageListener and its related APIs provide a simple and secure mechanism to establish communication between web contents and the WebView embedder app.
  • isMultiProcessEnabled API to check whether WebView is running in multi process. This is possible starting in Android O and it means web content is rendered in a sandboxed renderer process separate to the application process. This sandboxed renderer may be shared with other WebViews in the same application but it's not shared with other application processes.

Version 1.3.0-rc02

August 5, 2020

androidx.webkit:webkit:1.3.0-rc02 is released. Version 1.3.0-rc02 contains these commits.

Bug Fixes

  • This fixes a compatibility issue where WebMessageListener would sometimes crash during local development if your app was started with Android Studio instant run.

Version 1.3.0-rc01

June 24, 2020

androidx.webkit:webkit:1.3.0-rc01 is released with no changes since 1.3.0-beta01. Version 1.3.0-rc01 contains these commits.

Version 1.3.0-beta01

June 10, 2020

androidx.webkit:webkit:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits.

New Features

  • ForceDarkStrategy API to control WebView darkening (CSS/web content darkening versus auto darkening).
  • WebMessageListener APIs provide a simple and secure mechanism to establish communication between web contents and the WebView embedder app.
  • MultiProcessEnabled API to check if WebView is running in multi process mode.

Version 1.3.0-alpha03

May 27, 2020

androidx.webkit:webkit:1.3.0-alpha03 is released. Version 1.3.0-alpha03 contains these commits.

API Changes

  • addWebMessageListener method now receives a Set<String> of allowed origin rules (previously a List<String>).

Version 1.3.0-alpha02

April 29, 2020

androidx.webkit:webkit:1.3.0-alpha02 is released. Version 1.3.0-alpha02 contains these commits.

New Features

  • MultiProcessEnabled API to check if WebView is running in multi process mode.

API Changes

  • All dark strategy constants are now prefixed with DARK_STRATEGY.

Version 1.3.0-alpha01

April 15, 2020

androidx.webkit:webkit:1.3.0-alpha01 is released. Version 1.3.0-alpha01 contains these commits.

New Features

  • ForceDarkStrategy API to control WebView darkening (CSS/web content darkening versus auto darkening).
  • WebMessageListener APIs provide a simple and secure mechanism to establish communication between web contents and the WebView embedder app.

Version 1.2.0

Version 1.2.0

March 4, 2020

androidx.webkit:webkit:1.2.0 is released. Version 1.2.0 contains these commits.

Major changes since 1.1.0

  • Added the ForceDark API to control if WebViews should be rendered in dark mode.

Version 1.2.0-rc01

February 19, 2020

androidx.webkit:webkit:1.2.0-rc01 is released with no changes since 1.2.0-beta01. Version 1.2.0-rc01 contains these commits.

Version 1.2.0-beta01

February 5, 2020

androidx.webkit:webkit:1.2.0-beta01 is released with no changes since 1.2.0-alpha01. Version 1.2.0-beta01 contains these commits.

Version 1.2.0-alpha01

December 18, 2019

androidx.webkit:webkit:1.2.0-alpha01 is released. Version 1.2.0-alpha01 contains these commits.

New features

  • ForceDark API to control if WebViews should be rendered in dark mode.

Version 1.1.0

Version 1.1.0

November 7, 2019

androidx.webkit:webkit:1.1.0 is released. Version 1.1.0 contains these commits.

Important changes since 1.0.0

  • Getter APIs to complement setWebViewClient() and setWebChromeClient().
  • ProxyController API to set a network request proxy for an app's WebViews.
  • WebViewAssetLoader API to simplify loading APK assets, resources, and files from the app data directory via request interception. This allows access to web and local resources without disabling CORS.
  • TracingController API to collect WebView tracing information for debugging purposes.
  • RenderProcess APIs to manage WebView renderer services, and to detect when poorly behaved content causes WebView renderers to become unresponsive.
  • Updated existing APIs to include nullability (@NonNull, @Nullable) and thread (@UiThread, @WorkerThread) annotations.

Version 1.1.0-rc01

October 9, 2019

androidx.webkit:webkit:1.1.0-rc01 is released. Version 1.1.0-rc01 contains these commits.

Bug fixes

  • Fixed an issue where setWebViewRenderProcessClient() could crash if passed a null client.

Version 1.1.0-beta01

September 5, 2019

androidx.webkit:webkit:1.1.0-beta01 is released. The commits included in this version can be found here.

New features

  • New InternalStoragePathHandler in WebViewAssetLoader to load files from the app's data directory.

API changes

  • ProxyConfig#getProxyRules() now returns an unmodifiable list of ProxyRule instances, which is a new class to hold a scheme filter and its corresponding proxy URL.

Bug fixes

  • WebViewAssetLoader defaults to a "text/plain" MIME type (rather than null) when it can't guess the MIME type from the file path.
  • WebViewAssetLoader no longer throws a NullPointerException when loading files with special characters in their path names.

Version 1.1.0-alpha02

August 7, 2019

androidx.webkit:webkit:1.1.0-alpha02 is released. The commits included in this version can be found here.

New features

  • WebViewAssetLoader exposes the PathHandler interface to allow apps to create custom path-handling functionality.

API changes

  • WebViewAssetLoader is now a final class, since it's not meant to be subclassed.
  • WebViewAssetLoader#PathHandler implementations are now public and final.
  • Minor changes to ProxyConfig method names.
  • ProxyController: added new methods addDirect() and addDirect(String) to connect directly to servers; removed DIRECT String.
  • Updated existing APIs to include nullability (@NonNull, @Nullable) and thread (@UiThread, @WorkerThread) annotations.

Version 1.1.0-alpha01

May 7, 2019

androidx.webkit:webkit:1.1.0-alpha01 is released. The commits included in this version can be found here.

New features

  • Getter APIs to complement setWebViewClient() and setWebChromeClient()
  • ProxyController API to set a network request proxy for an app's WebViews.
  • AssetLoader API to simplify loading APK assets and resources via request interception, allowing access to web resources without disabling CORS.
  • TracingController API to collect WebView tracing information for debugging purposes.
  • RenderProcess APIs to manage WebView renderer services, and to detect when poorly behaved content causes WebView renderers to become unresponsive.

Bug fixes

  • Minor fixes to documentation formatting for existing APIs.