embed crosswalk in android studio

Following: https://diego.org/2015/01/07/embedding-crosswalk-in-android-studio/

  1. Open AndroidStudio to project view in app folder edit build.gradle:

    repositories {
    maven {
    url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'}}
    
    
    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'org.xwalk:xwalk_core_library:10.39.235.15'}
    
  2. sync project.

  3. add this view in layout xml.

    <org.xwalk.core.XWalkView
    android:id="@+id/xwalkWebView"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000"
    />
    
  4. In activity or fragment:

    import org.xwalk.core.XWalkPreferences;
    import org.xwalk.core.XWalkView;
    
  5. in onCreate:

    XWalkView xWalkWebView=(XWalkView)findViewById(R.id.xwalkWebView);
    xWalkWebView.clearCache(true);
    xWalkWebView.load("http://...", null);
    // turn on debugging
    XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
    

I’ve successfully used WebRTC in XWalkView on android 4.3 and 4.4 after failing with the out of the box WebView. I think the android 5 Lollipop is up to par with latest chromium.

Leave a Comment