Skip to content →

Month: September 2016

Embedding Crosswalk in Android Studio – UPDATED

This post is an updated version of the original one:

Note: The Crosswalk team has stopped development on this project. You can read more about it here: Crosswalk 23 to be the last Crosswalk release

Crosswalk is a web runtime that replaces the built in WebView used by Android. Crosswalk is based on Google Chromium. Why use Crosswalk and not the built in WebView? The built in WebView varies greatly with each Android OS version. I’ve run into many problems because of the differences between the two. When you use Crosswalk you can work with a consistent WebView across all Android OS versions. Besides that, it has better HTML5 support. Read this article for more reasons “Why use Crosswalk for Android Builds?

The instructions for embedding Crosswalk in your application are based on ADT and they are complicated. Adding Crosswalk to Android Studio is much easier if you use the maven2 releases.

Here are steps for creating a new Android application in Android Studio and embedding Crosswalk.

Create a new Android Project

From the menu choose “File > New Project”

Give your application a name “CrosswalkDemo”

Give it a domain and project location and press “Next”.

Select “Phone and Tablet”, Minimum SDK “API 19” and press “Next”.

Select “Blank Activity” and press “Next”.

Use the defaults for the Activity name and press “Finish”.

Configure Crosswalk

Identify which Crosswalk release you want to install. You can find the releases here:

For this demo I choose version 20.50.533.12, which is found here:

Open the file:

First we need to add the Maven repository like this:

repositories {
    maven {
        url ''

Then add this to your dependencies:

compile 'org.xwalk:xwalk_core_library:20.50.533.12'

The finished file should look like:

apply plugin: ''

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId ""
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

repositories {
    maven {
        url ''

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ''
    compile 'org.xwalk:xwalk_core_library:20.50.533.12

Update the Code

Add an XWalkView to your layout like:

<LinearLayout xmlns:android=""



In your activity, find the XWalkView and then load a url like:

xWalkWebView.load("", null);

And add these permissions to your AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

That’s pretty much it.

The entire activity looks like:


import android.os.Bundle;

import org.xwalk.core.XWalkActivity;
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;

public class MainActivity extends XWalkActivity {
    private XWalkView xWalkWebView;

    protected void onCreate(Bundle savedInstanceState) {



        // turn on debugging
        XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);

    protected void onXWalkReady() {
        // Do anything with embedding API
        xWalkWebView.load("", null);



You can download a sample project here:

More details about the AAR Crosswalk release can be found here:

Exclude x86 libraries

If you want to exclude x86 libraries for a smaller APK, then uncomment this code in build.gradle. This will only build armeabi-v7a libraries.

// Remove other libraries
ndk {
    abiFilters "armeabi-v7a"

64 Bit Build

Crosswalk creates the binaries for ARM 64 here:

To use one of these instead, first you need to download it:

curl -O

Then install it to your local maven repository:

mvn install:install-file -DgroupId=org.xwalk -DartifactId=xwalk_core_library \
      -Dversion=20.50.533.12-arm64 -Dpackaging=aar  \
      -Dfile=xwalk_core_library-20.50.533.12-arm64.aar \

Update your build.gradle to use your local maven repository:

repositories {

Then you can reference it in your build.gradle:

compile 'org.xwalk:xwalk_core_library:20.50.533.12-arm64'
Comments closed