Crosswalk crashes with AssertionFailedError
Asked Answered
V

1

8

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.loop(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!

Viticulture answered 16/8, 2016 at 6:51 Comment(4)
having the same issue, and I'm curios of any solutionsGoalkeeper
@Goalkeeper Looking at the XWalk code, this exception is thrown at any unsupported operation exceptions which is caused by calling methods in xwalk before it is ready. Did you had a look at this link - crosswalk-project.org/jira/browse/XWALK-4938 which specifies counter measures to avoid thisVesture
Experiencing this for the first time. Using ionic2 and fabric.io with xwalk. I'm not altering any native java code. hints were to post this bug(?) are appreciated.Etan
@Viticulture Have you solved this issue?Enounce
A
1

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

Alvera answered 31/10, 2016 at 16:23 Comment(1)
Thanks for the answer, but I'm not altering any java code. I'm just putting together some cordova plugins and I'm only coding javascript.Goalkeeper

© 2022 - 2024 — McMap. All rights reserved.