Linux host setup
These instructions have been tested on Fedora Linux 20, 64 bit. If you are using a different platform, you may need to modify them to suit your environment (e.g. use apt-get instead of yum if using Ubuntu, change package names where they differ from Fedora's package names).
These steps will enable you to develop Crosswalk applications to run on Android:
- Install Python
- Install the Oracle Java Development Kit (JDK)
- Install Ant
- Configure the tools
- Install the Android SDK
- Download the Crosswalk Android app template
- Verify your environment
Install Python
Python can usually be installed using your system's package manager. For example, on Fedora:
sudo yum install python
Install the Oracle JDK
The Oracle JDK has to be downloaded manually (you must accept a licence agreement):
Go to the Oracle Java JDK download page in a browser:
http://www.oracle.com/technetwork/java/javase/downloads/
Choose the Java version to download (Java 7 is known to work).
Choose a JDK download and accept the licence agreement.
Once downloaded, unpack the archive file:
tar zxvf <jdk file>.tar.gzThe JDK binaries are in
<unpacked directory>/bin. We'll add that directory to our path later.
Install Ant
Download Ant from: http://www.apache.org/dist/ant/binaries/
Version 1.9.3 is known to work.
Unzip it (using WinZip or similar).
Rename the unzipped directory to
ant.
Configure the tools
The next step is to set up your environment so that binaries and scripts which were installed manually (ant, JDK) are on your PATH. Edit your ~/.bashrc file, adding these lines to the end:
export PATH=<path to ant>/bin:<path to JDK>/bin:$PATH
It's also advisable to set the JAVA_HOME environment variable, to ensure that Ant uses the expected version of Java (rather than other versions of Java which may be installed on your system). Also in the ~/.bashrc file, add this line:
export JAVA_HOME=<path to JDK>
(Note that you should not include the bin/ directory in the path for JAVA_HOME.)
Then refresh your PATH variable in the shell:
> source ~/.bashrc
Note that we prepend the new paths to the PATH variable to ensure that we use scripts and binaries from our newly-installed packages.
Install the Android SDK
Download the Android SDK from http://developer.android.com/sdk/index.html.
Extract the SDK from the archive file you downloaded.
Add the Android SDK directories to your
PATHby editing~/.bashrc:export PATH=<path to Android SDK>:$PATH export PATH=<path to Android SDK>/tools:$PATH export PATH=<path to Android SDK>/platform-tools:$PATHNote that, depending on your how you installed the SDK, the
toolsandplatform-toolsdirectories may be in slightly different locations. Amend the above paths appropriately.Refresh your
PATHvariable:> source ~/.bashrcRun the SDK Manager. You can do this from a bash shell as follows:
> androidIn the SDK Manager window, select the following items from the list:
[ ] Tools [x] Android SDK Platform-tools <version> [x] Android SDK Build tools <version> [ ] Android 4.3 (API <version>) [x] SDK PlatformNote that if you are using devices with versions of Android later than 4.3, you should install the platform tools, build tools and SDK platform for those versions too.
Download the Crosswalk Android app template
The Crosswalk Android distribution contains an application template which can be used as a wrapper for an HTML5 application. It also includes a script which will convert a wrapped HTML5 application into an installable Android apk file.
To get Crosswalk Android:
Download the version you want from the Downloads page. We suggest that you use the stable Android version (${XWALK-STABLE-ANDROID-X86}).
Unzip it. You should now have a
crosswalk-${XWALK-STABLE-ANDROID-X86}directory.
Verify your environment
Check that you have installed the tools properly by running these commands:
> java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
> ant -version
Apache Ant(TM) version 1.9.3 compiled on December 23 2013
> python --version
Python 2.7.6
> adb version
Android Debug Bridge version 1.0.31
Now the host is setup, you can prepare your targets.
English
