Hello Crosswalk Team,

I have custom Android Cordova project that uses an embedded CordovaWebView 
(SystemWebView in Cordova Android 4.+).  We’ve been having multiple issues 
based on the stock webView so I’m interested in trying Crosswalk within the 
project.  I’ve stepped through the documentation on the Crosswalk site 
successfully.  Unfortunately, our project is not a typical Cordova install.  
I’ve attempted to install the Crosswalk plugin as well as add 
xwalk_core_library to my project as a library module.  I get everything to 
compile, but ultimately receive runtime errors that I can’t seem to figure out.

Here is some basic versioning information:

Cordova:  5.3.1
Cordova Android: 4.1.1
Crosswalk: 14.43.343.24
Crosswalk Cordova Plugin: 1.3.1

My working Cordova only code:

Layout XML file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

  .... other layout elements not related to Cordova....

    <org.apache.cordova.engine.SystemWebView
        android:id="@+id/cdvWebView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</RelativeLayout>

My Activity's WebView Initialization flow (Activity implements 
CordovaInterface):


SystemWebView systemWebView = (SystemWebView) findViewById(R.id.cdvWebView);
CordovaWebView cdvWebView = new CordovaWebViewImpl(new 
SystemWebViewEngine(systemWebView));

ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(this);

cdvWebView.init(this, parser.getPluginEntries(), parser.getPreferences());

As stated, the above code is working in my existing project.  The following is 
was I have tried to implement the XWalkCordovaView:

Altered XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

  .... other layout elements not related to Cordova....

    <org.crosswalk.engine.XWalkCordovaView
        android:id="@+id/cdvWebView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</RelativeLayout>

Altered Activity Flow:

XWalkCordovaView xWalkCordovaView = (XWalkCordovaView) 
findViewById(R.id.cdvWebView);
CordovaWebView cdvWebView = xWalkCordovaView.getCordovaWebView();

ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(this);

cdvWebView.init(this, parser.getPluginEntries(), parser.getPreferences());

The above code compiles.  When running, I get the following Stack Track:

 java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.adpmobile.android.fit/com.adpmobile.android.ui.AuthAppActivity}:
 android.view.InflateException: Binary XML file line #18: Error inflating class 
org.crosswalk.engine.XWalkCordovaView
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
  at android.app.ActivityThread.access$800(ActivityThread.java:135)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:136)
  at android.app.ActivityThread.main(ActivityThread.java:5017)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.view.InflateException: Binary XML file line #18: Error 
inflating class org.crosswalk.engine.XWalkCordovaView
  at android.view.LayoutInflater.createView(LayoutInflater.java:621)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  at 
android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:240)
  at 
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
  at com.adpmobile.android.ui.AuthAppActivity.onCreate(AuthAppActivity.java:76)
  at android.app.Activity.performCreate(Activity.java:5231)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
  ... 11 more
 Caused by: java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Constructor.constructNative(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at android.view.LayoutInflater.createView(LayoutInflater.java:595)
  ... 22 more
 Caused by: junit.framework.AssertionFailedError: Please have your activity 
extend XWalkActivity for shared mode
  at junit.framework.Assert.fail(Assert.java:50)
  at org.xwalk.core.XWalkCoreWrapper.initEmbeddedMode(XWalkCoreWrapper.java:189)
  at org.xwalk.core.XWalkPreferences.reflectionInit(XWalkPreferences.java:207)
  at org.xwalk.core.XWalkPreferences.setValue(XWalkPreferences.java:97)
  at 
org.crosswalk.engine.XWalkCordovaView.setGlobalPrefs(XWalkCordovaView.java:37)
  at org.crosswalk.engine.XWalkCordovaView.<init>(XWalkCordovaView.java:52)
  ... 25 more

I cannot extend XWalkActivity as my activity as I’m already extending another 
base activity.  I could not find any documentation on the Crosswalk site 
specific to an embedded implementation.  Is there anyone on the Crosswalk team 
that could guid me through this or point me in the right direction.

Any help would be greatly appreciated.

Thanks in advance,

Steve Bergamini
Lead Mobile Developer
ADP

----------------------------------------------------------------------
This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, notify the sender immediately by return email and delete the message 
and any attachments from your system.
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to