# cordova-plugin-webview-crosswalk
**Repository Path**: huangang/cordova-plugin-webview-crosswalk
## Basic Information
- **Project Name**: cordova-plugin-webview-crosswalk
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: develop
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-09-09
- **Last Updated**: 2021-09-09
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# cordova-plugin-webview-crosswalk
Makes your Cordova application use the [Crosswalk WebView](https://crosswalk-project.org/)
instead of the System WebView. Requires cordova-android 4.0 or greater.
### Benefits
* WebView doesn't change depending on Android version
* Capabilities: such as WebRTC, WebAudio, Web Components
* Performance improvements (compared to older system webviews)
### Drawbacks
* Increased memory footprint
* An overhead of ~30MB (as reported by the RSS column of ps)
* Increased APK size (about 17MB)
* Increased size on disk when installed (about 50MB)
* Crosswalk WebView stores data (IndexedDB, LocalStorage, etc) separately from System WebView
* You'll need to manually migrate local data when switching between the two (note: this is fixed in Crosswalk 15)
### Install
The following directions are for cordova-cli (most people). Alternatively you can use the [Android platform scripts workflow](PlatformScriptsWorkflow.md).
* Open an existing cordova project, with cordova-android 4.0.0+, and using the latest CLI. Crosswalk variables can be configured as an option when installing the plugin
* Add this plugin
```
$ cordova plugin add cordova-plugin-webview-crosswalk
```
* Build
```
$ cordova build android
```
The build script will automatically fetch the Crosswalk WebView libraries from Crosswalk project download site (https://download.01.org/crosswalk/releases/crosswalk/android/maven2/) and build for both X86 and ARM architectures.
For example, building android with Crosswalk generates:
```
/path/to/hello/platforms/android/build/outputs/apk/hello-x86-debug.apk
/path/to/hello/platforms/android/build/outputs/apk/hello-armv7-debug.apk
```
Note that you might have to run `cordova clean` before building, if you previously built the app without cordova-plugin-webview-crosswalk. Also, manually uninstall the app from the device/emulator before attempting to install the crosswalk-enabled version.
Also note that it is also possible to publish a multi-APK application on the Play Store that uses Crosswalk for Pre-L devices, and the (updatable) system webview for L+:
To build Crosswalk-enabled apks, add this plugin and run:
$ cordova build --release
To build System-webview apk, remove this plugin and run:
$ cordova build --release -- --minSdkVersion=21
### Configure
You can try out a different Crosswalk version by specifying certain variables while installing the plugin, or by changing the value of `xwalkVersion` in your `config.xml` after installing the plugin. Some examples:
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_VERSION="org.xwalk:xwalk_core_library:14+"
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_VERSION="xwalk_core_library:14+"
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_VERSION="14+"
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_VERSION="14"
You can also use a Crosswalk beta version. Some examples:
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_VERSION="org.xwalk:xwalk_core_library_beta:14+"
You can set [command-line flags](http://peter.sh/experiments/chromium-command-line-switches/) as well:
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_COMMANDLINE="--disable-pull-to-refresh-effect"
You can use the Crosswalk [shared mode](https://crosswalk-project.org/documentation/shared_mode.html) which allows multiple Crosswalk applications to share one Crosswalk runtime downloaded from the Play Store.
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_MODE="shared"
You can also use a Crosswalk beta version on shared mode, e.g.:
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_VERSION="org.xwalk:xwalk_shared_library_beta:14+"
You can use the Crosswalk [lite mode](https://crosswalk-project.org/documentation/crosswalk_lite.html) which is the Crosswalk runtime designed to be as small as possible by removing less common libraries and features and compressing the APK.
cordova plugin add cordova-plugin-webview-crosswalk --variable XWALK_MODE="lite"
You can set background color with the preference of BackgroundColor.
You can also set user agent with the preference of xwalkUserAgent.
### Usage Notes
* preference BackgroundColor set "transparent", "@null" no effect.
* if use cordova-plugin-qrscanner, set preference CrosswalkAnimatable with "true".
* on above API 23 I'm facing java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable at android.view.TextureView.setBackgroundDrawable.
now you can use the [x5 WebView](https://github.com/liuxiaoy/cordova-plugin-webview-x5)
### Release Notes
#### 2.5.0 (March 10, 2020)
* Use system WebView on above API 23
#### 2.4.1 (November 5, 2019)
* Base on https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview 2.4.0
* Keep compatibility with cordova-cli 9.0