This tutorial explains how to write Crosswalk Android extensions using Java.
The application you'll build in the tutorial demonstrates a very simple "echo" extension. This simply returns the string passed to it, prefixed with "You said: ". The extension is deliberately trivial so that the tutorial can focus on explaining the principles behind Crosswalk Android extensions.
This tutorial doesn't cover best practices for web development. For example, it avoids grunt and bower and doesn't use any third party front-end libraries, for simplicity's sake. Instead, it focuses on helping you explore the pieces of a hybrid Crosswalk application and how they fit together.
By the end of the tutorial, you will be able to develop your own Java extensions for Crosswalk applications on Android.
Introduction to the tutorial
In this tutorial, you will build a Crosswalk Android application with a Java extension. This consists of two main pieces:
A Crosswalk extension
The extension consists of:
- Java source code: Standard Android/Java classes, packaged into a jar file.
The extension you'll write provides an echo service, which prefixes any string passed to it and returns it.
Note that a Crosswalk application can use multiple extensions if desired.
An HTML5 web application
The project you create will also contain a few files to assist with packaging the above components into an
.apk package file you can install on the Android target.
All of the source code for the tutorial is available as part of the crosswalk-samples download, or on github at https://github.com/crosswalk-project/crosswalk-samples (inside the