抱歉,该网页目前还不存在中文版本,请继续浏览其他网页!

Crosswalk App Tools

Crosswalk-app-tools is a new, NPM-based tool for creating and building Crosswalk applications. It replaces the Python-based make_apk.py script. It is based on Node.js and therefore a cross-platform tool. Current host platforms supported are Microsoft Windows, Linux, and Apple OS X.

Pre-requisites

  • Node.js
  • NPM
  • Android SDK with 5.0 (target-21) or later
  • Java JDK
  • Apache Ant

Full setup instructions are available in the Getting Started section.

Installation

> npm install -g crosswalk-app-tools

Root or adminstrative priveleges may be needed.

After installing, check dependencies:

> crosswalk-app check android

Two executables are provided:

  • crosswalk-app: implements low level helper commands
  • crosswalk-pkg: main tool for creating packages

Usage

crosswalk-app

Crosswalk Project application creation and build tool

Usage: crosswalk-app <options> crosswalk-app check [<platforms>] Check host setup Check all platforms if none given crosswalk-app manifest <path> Initialize web manifest in <path> --package-id=<pkg-id> Canonical package name e.g. com.example.foo --platforms=<target> Optional, e.g. "windows" crosswalk-app create <package-id> Create project <package-id> --platforms=<target> Optional, e.g. "windows" crosswalk-app build <type> [<dir>] Build project to create packages type = [release|debug] Defaults to "debug" when not given Builds in current dir by default crosswalk-app platforms List available target platforms crosswalk-app help Display usage information crosswalk-app version Display version information Options for Android platform Usage: crosswalk-app create 'android' <options> --android-crosswalk Channel name (stable/beta/canary) or version number (w.x.y.z) or crosswalk zip or xwalk_app_template dir --android-lite Use crosswalk-lite, see Crosswalk Wiki for details --android-shared Depend on shared crosswalk installation --android-targets Target ABIs to create Environment variables for platform 'android' CROSSWALK_APP_TOOLS_CACHE_DIR Keep downloaded files in this dir Options for 'build' command Usage: crosswalk-app build <options> --android-targets Target ABIs to build Options for Windows platform --windows-crosswalk Path to crosswalk zip

crosswalk-pkg

Crosswalk Project application packaging tool

Usage: crosswalk-pkg <options> <path> <options> -a --android=<android-conf> Extra configurations for Android -c --crosswalk=<version-spec> Specify Crosswalk version or path -h --help Print usage information -k --keep Keep build tree for debugging -m --manifest=<package-id> Fill manifest.json with default values -p --platforms=<android|windows> Specify target platform -r --release Build release packages -t --targets=<target-archs> Target CPU architectures -v --version Print tool version <path> Path to directory that contains a web app <android-conf> Quoted string with extra config, e.g. "shared" "shared" Build APK that depends on crosswalk in the Google Play Store "lite" Use crosswalk-lite, see Crosswalk Wiki <package-id> Canonical application name, e.g. com.example.foo, needs to - contain 3 or more period-separated parts - begin with lowecase letters <target-archs> List of CPU architectures for which to create packages. Currently supported ABIs are: armeabi-v7a, arm64-v8a, x86, x86_64 - Prefixes will be matched, so "a","ar", or "arm" yield both ARM APKs - Same for "x" and "x8", but "x86" is an exact match, only x86-32 conforms - Short-hands "32" and "64" build ARM and x86 for the requested word size - Default behavior is equivalent to "32", creation of 32-bit installers Example: --targets="arm x86" builds both ARM plus 32-bit x86 packages <version-spec> - Channel name, i.e. stable/beta/canary - Version number, e.g. 14.43.343.25 - Path to release, e.g. $HOME/Downloads/crosswalk-14.43.343.25.zip - Path to build, e.g. crosswalk/src/out/Release/xwalk_app_template When passing a local file or directory, only the contained ABIs can be built. See <target-archs> for details. Environment variables CROSSWALK_APP_TOOLS_CACHE_DIR=<path>: Keep downloaded files in this dir

Example: Creating and packaging an application

To get started, all you need is a web manifest and an html file. The web manifest holds name and settings for your application. A minimal manifest.json looks like this:

{
  "name": "My first Crosswalk application",
  "start_url": "index.html",
  "xwalk_package_id": "com.example.foo"
}

Then add an index.html in the same directory:

<!DOCTYPE html>
<html>
   <head>
      <title>My first Crosswalk application</title>
   </head>
   <body>This is my first Crosswalk application</body>
</html>

Finally, time to create the apk package:

> crosswalk-pkg <path>

This sets up a skeleton project, downloads and imports Crosswalk, and creates a package using the files above.

License

The license for this project is the Apache License Version 2.0, please refer to the LICENSE-APACHE-V2 included with the package for details.