简体   繁体   中英

Crosswalk crashes with AssertionFailedError

Crashlytics reports the following problem, that is affecting a good percentage of the users of my application:

Fatal Exception: junit.framework.AssertionFailedError: Cannot call this method before xwalk is ready at junit.framework.Assert.fail(Assert.java:50) at org.xwalk.core.XWalkView.setZOrderOnTop(XWalkView.java:1271) at org.crosswalk.engine.XWalkWebViewEngine.initWebViewSettings(XWalkWebViewEngine.java:193) at org.crosswalk.engine.XWalkWebViewEngine.access$000(XWalkWebViewEngine.java:55) at org.crosswalk.engine.XWalkWebViewEngine$2.run(XWalkWebViewEngine.java:90) at org.xwalk.core.XWalkActivityDelegate.onActivateCompleted(XWalkActivityDelegate.java:179) at org.xwalk.core.XWalkLibraryLoader$ActivateTask.onPostExecute(XWalkLibraryLoader.java:314) at org.xwalk.core.XWalkLibraryLoader$ActivateTask.onPostExecute(XWalkLibraryLoader.java:277) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.lo op(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5034) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(NativeStart.java)

I just added crosswalk as a plugin and I don't think I call any method explicitly (Cannot call this method before xwalk is ready). Any ideas? Thanks in advance!

I think you're doing something to the XWalkView while it's still in the not-ready state.

In the latest version of Crosswalk, there are some changes to the lib that the Crosswalk runtime isn't loaded yet when onCreate() is called. Therefore, if you want to initialize XWalkView or do something, wait until XWalkActivity.onXWalkReady() is called.

The solution is :

  • Extend the activity containing XWalkView from XWalkActivity
  • Override XWalkActivity 's onXWalkReady() methods, and do necessary initialization stuff to the XWalkView there

As already stated here: https://crosswalk-project.org/apis/embeddingapidocs_v5/org/xwalk/core/XWalkActivity.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM