You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 7.8 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # cordova-plugin-crosswalk-webview
  2. Makes your Cordova application use the [Crosswalk WebView](https://crosswalk-project.org/)
  3. instead of the System WebView. Requires cordova-android 4.0 or greater.
  4. ### Benefits
  5. * WebView doesn't change depending on Android version
  6. * Capabilities: such as WebRTC, WebAudio, Web Components
  7. * Performance improvements (compared to older system webviews)
  8. ### Drawbacks
  9. * Increased memory footprint
  10. * An overhead of ~30MB (as reported by the RSS column of ps)
  11. * Increased APK size (about 17MB)
  12. * Increased size on disk when installed (about 50MB)
  13. * Crosswalk WebView stores data (IndexedDB, LocalStorage, etc) separately from System WebView
  14. * You'll need to manually migrate local data when switching between the two (note: this is fixed in Crosswalk 15)
  15. ### Install
  16. The following directions are for cordova-cli (most people). Alternatively you can use the [Android platform scripts workflow](PlatformScriptsWorkflow.md).
  17. * 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
  18. * Add this plugin
  19. ```
  20. $ cordova plugin add cordova-plugin-crosswalk-webview
  21. ```
  22. * Build
  23. ```
  24. $ cordova build android
  25. ```
  26. 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.
  27. For example, building android with Crosswalk generates:
  28. ```
  29. /path/to/hello/platforms/android/build/outputs/apk/hello-x86-debug.apk
  30. /path/to/hello/platforms/android/build/outputs/apk/hello-armv7-debug.apk
  31. ```
  32. Note that you might have to run `cordova clean` before building, if you previously built the app without cordova-plugin-crosswalk-webview. Also, manually uninstall the app from the device/emulator before attempting to install the crosswalk-enabled version.
  33. 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+:
  34. To build Crosswalk-enabled apks, add this plugin and run:
  35. $ cordova build --release
  36. To build System-webview apk, remove this plugin and run:
  37. $ cordova build --release -- --minSdkVersion=21
  38. ### Configure
  39. 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:
  40. <!-- These are all equivalent -->
  41. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_VERSION="org.xwalk:xwalk_core_library:14+"
  42. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_VERSION="xwalk_core_library:14+"
  43. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_VERSION="14+"
  44. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_VERSION="14"
  45. <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library:14+" />
  46. <preference name="xwalkVersion" value="xwalk_core_library:14+" />
  47. <preference name="xwalkVersion" value="14+" />
  48. <preference name="xwalkVersion" value="14" />
  49. You can also use a Crosswalk beta version. Some examples:
  50. <!-- These are all equivalent -->
  51. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_VERSION="org.xwalk:xwalk_core_library_beta:14+"
  52. <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library_beta:14+" />
  53. You can set [command-line flags](http://peter.sh/experiments/chromium-command-line-switches/) as well:
  54. <!-- This is the default -->
  55. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_COMMANDLINE="--disable-pull-to-refresh-effect"
  56. <preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
  57. 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.
  58. <!-- These are all equivalent -->
  59. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_MODE="shared"
  60. <preference name="xwalkMode" value="shared" />
  61. You can also use a Crosswalk beta version on shared mode, e.g.:
  62. <!-- Using a Crosswalk shared mode beta version -->
  63. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_VERSION="org.xwalk:xwalk_shared_library_beta:14+"
  64. 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.
  65. <!-- These are all equivalent -->
  66. cordova plugin add cordova-plugin-crosswalk-webview --variable XWALK_MODE="lite"
  67. <preference name="xwalkMode" value="lite" />
  68. You can set background color with the preference of BackgroundColor.
  69. <!-- Set red background color -->
  70. <preference name="BackgroundColor" value="0xFFFF0000" />
  71. You can also set user agent with the preference of xwalkUserAgent.
  72. <preference name="xwalkUserAgent" value="customer UA" />
  73. ### Release Notes
  74. #### 2.4.0
  75. * Keep compatibility with cordova-android 7.0 project structure
  76. #### 2.3.0 (January 21, 2017)
  77. * Uses the latest Crosswalk 23 stable version by default
  78. #### 2.2.0 (November 4, 2016)
  79. * Uses the latest Crosswalk 22 stable version by default
  80. * Keep compatible for Cordova-android 6.0 with evaluating Javascript bridge
  81. * This version requires cordova-android 6.0.0 or newer
  82. #### 2.1.0 (September 9, 2016)
  83. * Uses the latest Crosswalk 21 stable version by default
  84. #### 2.0.0 (August 17, 2016)
  85. * Uses the latest Crosswalk 20 stable version by default
  86. * Discontinue support for Android 4.0 (ICS) in Crosswalk starting with version 20
  87. #### 1.8.0 (June 30, 2016)
  88. * Uses the latest Crosswalk 19 stable version by default
  89. #### 1.7.0 (May 4, 2016)
  90. * Uses the latest Crosswalk 18 stable version by default
  91. * Support to use [Crosswalk Lite](https://crosswalk-project.org/documentation/crosswalk_lite.html), It's possible to specify lite value with the variable of XWALK_MODE at install plugin time.
  92. * [Cordova screenshot plugin](https://github.com/gitawego/cordova-screenshot.git) can capture the visible content of web page with Crosswalk library.
  93. * Doesn't work with Crosswalk 17 and earlier
  94. #### 1.6.0 (March 11, 2016)
  95. * Uses the latest Crosswalk 17 stable version by default
  96. * Support to [package apps for 64-bit devices](https://crosswalk-project.org/documentation/android/android_64bit.html), it's possible to specify 64-bit targets using the `--xwalk64bit` option in the build command:
  97. cordova build android --xwalk64bit
  98. #### 1.5.0 (January 18, 2016)
  99. * Uses the latest Crosswalk 16 stable version by default
  100. * The message of xwalk's ready can be listened
  101. #### 1.4.0 (November 5, 2015)
  102. * Uses the latest Crosswalk 15 stable version by default
  103. * Support User Agent and Background Color configuration preferences
  104. * Compatible with the newest Cordova version 5.3.4
  105. #### 1.3.0 (August 28, 2015)
  106. * Crosswalk variables can be configured as an option via CLI
  107. * Support for [Crosswalk's shared mode](https://crosswalk-project.org/documentation/shared_mode.html) via the XWALK_MODE install variable or xwalkMode preference
  108. * Uses the latest Crosswalk 14 stable version by default
  109. * The ANIMATABLE_XWALK_VIEW preference is false by default
  110. * Doesn't work with Crosswalk 14.43.343.17 and earlier
  111. #### 1.2.0 (April 22, 2015)
  112. * Made Crosswalk command-line configurable via `<preference name="xwalkCommandLine" value="..." />`
  113. * Disabled pull-down-to-refresh by default
  114. #### 1.1.0 (April 21, 2015)
  115. * Based on Crosswalk v13
  116. * Made Crosswalk version configurable via `<preference name="xwalkVersion" value="..." />`
  117. #### 1.0.0 (Mar 25, 2015)
  118. * Initial release
  119. * Based on Crosswalk v11