How to export to Android with Crosswalk

2

Stats

40,254 visits, 75,799 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Crosswalk is effectively the Google Chrome for Android browser turned in to a wrapper for apps. Since it's based on a real browser it has support for all the features Chrome has, including WebGL, Web Audio, WebRTC multiplayer, and more.

Crosswalk compatibility

Since Crosswalk is based on Chrome for Android, it supports the same features. As with Chrome for Android, it also only supports devices with Android 4.0+. However this is the vast majority of devices and soon older versions will disappear completely.

Crosswalk also makes some minor changes compared to the Chrome for Android browser:

    Obviously, there is no address bar or tabs feature; the game runs in fullscreen as if it were a native app. This means there is also no need to use the Browser object's Request fullscreen action. Chrome for Android can only start playing music in a touch event. Crosswalk can start playing music at any time. The Browser object's On back button, On menu button and On search button trigger In Crosswalk on devices which have these buttons. In Chrome for Android, they never trigger.

Testing for Crosswalk

The easiest way to test your game or app is to run it in the Chrome for Android browser. Using Preview over Wifi is a quick and convenient way to test on a different device. Since Crosswalk is based on Chrome for Android, it should run very similarly in terms of features and performance, except for the differences noted in Crosswalk compatibility above.

Building with PhoneGap Build

As of Construct 2 r216, you can build with Crosswalk using PhoneGap Build. Crosswalk is automatically used if the minimum Android version is lower than 5.0. If the minimum Android version is 5.0 or higher, the Android system web view can run the game without needing to use Crosswalk. The rest of this guide covers building with Crosswalk using the Intel XDK, which is free.

Building your app

To build your app, you need to use the Intel XDK. Click the link to download the XDK and install it.

Once installed, run the Intel XDK. Register a new account if you need to, and log in.

Export your project from Construct 2 choosing the Cordova export option (since Crosswalk is a Cordova-compatible platform).

In the Intel XDK, open the Projects tab.

Click Start A New Project.

Choose Import an Existing HTML5 Project.

Choose the folder you exported from Construct 2 as the Import Project from location. Enter a name for the XDK project and click Create.

Go back to the Projects tab. Your app's settings appear here:

Expand the Build settings section and switch to the Android-Crosswalk tab. Here you can specify all your app details such as the app ID, name, version, fullscreen mode, orientation lock, and perhaps opt-in to using a beta version of Crosswalk. Remember to increment the value in the App Version Code field by one each time you upload an updated version of your app to Google Play. If you don't, your newly uploaded APKs will be rejected.

Once you're done, expand the Plugins and permissions section. Here you can choose the required permissions for the app. Be sure to choose them carefully. If you request too many permissions, your app may look suspicious. You should set them all to "No", except any you specifically need, which may include:

Accelerometer (if you use the device motion from the Touch object)

Camera and Capture (if you use the User Media object with camera or microphone input)

Compass (if you use the device orientation from the Touch object)

Device should always be enabled

Geolocation (if you use the Geolocation object)

Vibration (notification) (if you use the Browser object's 'Vibrate' action)

Splashscreen if you want to show a splash screen while loading)

You may need additional options for third party plugins. Check your plugin documentation.

In the Launch icons and splash screens section you can upload icons and splash screen images in a variety of sizes. Be sure to provide icons in all four resolutions (96x96, 72x72, 48x48 and 36x36), or your application will have a default Cordova icon on some devices. The same is true for splash screens if you decide to include one.

Once you're done, go to the Build tab and click the Build button by Crosswalk for Android.

It may take a few minutes firstly to upload the project and then for it to be built. However once it's finished, the .APK will be available for download. It will also email a link to the download to the email address associated with your XDK account, and you can optionally email links to additional addresses. A convenient way to test the APK on a real device is to email the link to an email account that you can access from the device itself. Then you just need to check your email on your Android device, click the link, and download and install the APK.

You'll be given the option to download both x86 and ARM builds. The majority of Android devices are ARM, but to ensure you support the widest range of devices possible be sure to submit both versions. If you're just testing on your own device, check its specs to see if it has an ARM or x86 processor, or just try both APKs. Now you have your APKs ready to submit to the Google Play Store! You can get going with this from the Google Play Developer Console.

For more help or if you have any questions specific to Crosswalk, you can also visit the Intel HTML5 tools forum.

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!