-
Notifications
You must be signed in to change notification settings - Fork 123
zzz_archive [Create sample app with crosswalk cordova android]
The content of this page has been promoted to the main Crosswalk website at https://crosswalk-project.org/#documentation/cordova/develop_an_application.
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.
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.
The project generated by crosswalk-cordova-android Command-line Tool can be imported into Android Development Tool for GUI-based development.
- Open ADT. In “File” menu, choose “Import…”.
- In Import dialog, choose “Existing Android Code into Workspace” and click “Next” button.
- 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.
- 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.