David,
This is what I have done for Android ...
OVERVIEW
1) In Android Studio, start a new project and have the XWalkView download as a 
dependency2) Create a blank Activity with a RelativeLayout that fills the 
screen. Give it an ID.3) Programmatically instantiate XWalkView and add it to 
the RelativeLayout4) Load the HTML
It's an easy overview - but in practice about a day's work because 
https://crosswalk-project.org/documentation/embedding_crosswalk.html seems 
outdated.
DETAILS
1) update the build.gradle in your project to look like :
buildscript {    repositories {        jcenter()        maven {            url 
'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'        }  
  }    dependencies {        classpath 'com.android.tools.build:gradle:1.0.0'   
 }}apply plugin: 'com.android.application'
repositories {    jcenter()    maven {        url 
'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'    }}
android {    compileSdkVersion 21    buildToolsVersion '22.0.1'    
defaultConfig {        applicationId "com.my.android.project"        
minSdkVersion 14        targetSdkVersion 21        versionCode 1        
versionName "1.1"        multiDexEnabled true    }    dexOptions {        
jumboMode = true        incremental true        javaMaxHeapSize "2048M"    }    
buildTypes {        release {            minifyEnabled false            
proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'        }    }    packagingOptions {        exclude 
'META-INF/DEPENDENCIES'        exclude 'META-INF/NOTICE'        exclude 
'META-INF/LICENSE'        exclude 'META-INF/LICENSE.txt'        exclude 
'META-INF/NOTICE.txt'    }    productFlavors {    }}
dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    
releaseCompile project(path: ':YOURPROJECTFOLDER', configuration: 'release')    
debugCompile project(path: ':YOURPROJECTFOLDER', configuration: 'debug')    // 
Needed to overcome the 64K Methods limit    compile 
'com.android.support:multidex:1.0.0'}

2) XML and Programmatic Instantiation - this is necessary due to the XWalkView 
constructor having a bug :
Bug details ... see below, the context is cast to an Activity... this totally 
breaks it for XML instantiation
public XWalkViewInternal(Context context, AttributeSet attrs) {
    super(convertContext(context), attrs);

    checkThreadSafety();
    mActivity = (Activity) context;
    mContext = getContext();
    init(mContext, attrs);
}
So the "manual way" around it is ...
        <RelativeLayout            android:id="@+id/id_xwalkview"            
android:layout_width="match_parent"            
android:layout_height="match_parent">        </RelativeLayout>
3) Java Code
        mContainer = (RelativeLayout) findViewById(R.id.id_xwalkview);        
mWebView = new XWalkView(mParentActivity, mParentActivity);        
RelativeLayout.LayoutParams relativeParams = new 
RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 
ViewGroup.LayoutParams.MATCH_PARENT);        mContainer.addView(mWebView, 
relativeParams);

4) The final step is loading dynamically generated HTML
StringBuilder strHTML = new 
StringBuilder();strHTML.append("<html><head></head><body>");// add your HTML 
herestrHTML.append("</body></html>");final String completeHTML = 
strHTML.toString();
// loading with XWalkViewmWebView.load(null, completeHTML);


That's all there's to it. LOL it took a day because all this useful information 
was not in one spot.By the way, XWalkView is awesome for HTML5 compared to the 
ridiculously fragmented experience of WebView.

Alexander
Date: Wed, 22 Apr 2015 15:29:13 -0700
From: [email protected]
To: [email protected]
Subject: [Crosswalk-help] Webdriver setup

Hello,
I'm trying run tests on an android device. I already have those tests running 
using webdriver.io on chrome using selenium.Now I want to run those tests on a 
xwalk webview. I don't really have an 'application' for that, I don't want to 
test an application but some dynamically injected html/js in a simple crosswalk 
webview.I'm not a selenium expert and I'm lost, between selenium, webdriver, 
xwalk, xwalkwebdriver.I manage to setup xwalkwebdriver and if I run the tests I 
get a blank page and an error.I'm also able to run an existing application 
(org.xwalk.app.hello.world) on a device using correct capabilities but then I 
get 
DevTools request: http://127.0.0.1:12074/json/versionDevTools request failed

Then obviously it fail.
I'm lost...If somebody can give me an overview of the setup I need to do what I 
want, I will be able to try and to ask more precise questions if needed.
Thanx,David


_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help             
                          
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to