Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

zzz_archive [Create sample app with crosswalk cordova android]

Elliot Smith edited this page Jun 6, 2014 · 1 revision

The content of this page has been promoted to the main Crosswalk website at https://crosswalk-project.org/#documentation/cordova/develop_an_application.

Create, Build and Run a Sample App with Command-line Tool:

Create a sample app, for example (You may supply --shared switch to avoid copying crosswalk-cordova-android/framework folder into each project):

$ /path/to/crosswalk-cordova-android/bin/create HelloWorld com.example.helloworld HelloWorld

A new project is created in folder HelloWorld. The example HTML, JS and CSS files are located in /path/to/HelloWorld/assets/www (You may replace them with yours later).

Then build and run the sample app:

$ cd HelloWorld
$ ./cordova/build
$ ./cordova/run

You will see the 'APACHE CORDOVA' page with a blinking 'DEVICE IS READY' tag.

Please refer to Android Command-line Tools for more command-line commands.

Set Permissions

Some HTML5 APIs which access devices require developers to set appropriate permissions in AndroidManifest.xml to work correctly. For example, if your app calls getUserMedia, it needs to add

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />

into AndroidManifest.xml. Please refer to Android manifest permissions for more details.

Importing a Crosswalk-based Cordova Android Project into Eclipse

The project generated by crosswalk-cordova-android Command-line Tool can be imported into Android Development Tool for GUI-based development.

  1. Open ADT. In “File” menu, choose “Import…”.
  2. In Import dialog, choose “Existing Android Code into Workspace” and click “Next” button.
  3. ADT prompts a file browser window, then choose the generated app folder, say “HelloWorld”. The “Import Projects” dialog will show it is ready to import three projects: “xwalk_core_library”, “HelloWorld-CordovaLib” and “HelloWorld”. Then click “Finish” button.
  4. Build the each project. Start from “xwalk_core_library”, then “CordovaLib” and last “HelloWorld”. If all builds pass, you are ready to develop the app in the ADT.
Clone this wiki locally