Create Sample App With Crosswalk Cordova Android - wuhengzhi/crosswalk-website GitHub Wiki
If you haven't setup the development environment yet, please refer to Setup Development Environment
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.
- Import Crosswalk-based Cordova Android and XWalkCoreLibrary library projects by File > Import... > Existing Android Code Into Workspace. Point to /path/to/crosswalk-cordova-android/framework and click Finish. Notice: if you see error messages as "[2014-02-24 08:58:56 - xwalk_core_library] R.java was modified manually! Reverting to generated version!", you may need to turn-off Project > Automatically Build as workaround. Please track the bug XWALK-1036.
- Build xwalk_core_library and Cordova project by right clicking on each project then choose Build Project.
- Import the generated project by File > Import... > Existing Android Code. Point to the generated app path.
- Right click on the project root: Run as > Run Configurations
- Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)