简体   繁体   中英

Crosswalk returns “Crosswalk's APIs are not ready yet” in API Level 26

When running my app with XWalk (version 23.53.589.4) dependency, I am experiencing an exception once I call a XWalk API. Here is what the log looks like.

java.lang.RuntimeException: Crosswalk's APIs are not ready yet
    at org.xwalk.core.XWalkView.load(XWalkView.java:372)
    at com.ewise.android.api.MainActivity.onXWalkInitCompleted(MainActivity.java:869)
    at org.xwalk.core.XWalkInitializer$XWalkLibraryListener.onActivateCompleted(XWalkInitializer.java:264)
    at org.xwalk.core.XWalkLibraryLoader$ActivateTask.onPostExecute(XWalkLibraryLoader.java:349)
    at org.xwalk.core.XWalkLibraryLoader$ActivateTask.onPostExecute(XWalkLibraryLoader.java:317)
    at android.os.AsyncTask.finish(AsyncTask.java:695)
    at android.os.AsyncTask.-wrap1(Unknown Source:0)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

This only happens in Android API 26. I've tried it on API 27 and it seems to work just fine. Do take note that I have already initialized XWalk via the XWalkInitializer beforehand.

EDIT: Upon further investigation, it seems that the XWalkInitializer fails during this phase.

XWalkLibraryLoader.startActivate(this);

Adding this in the Activity maybe useful.

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
    try{
        return super.dispatchTouchEvent(event);
    } catch(java.lang.RuntimeException e) {
        if ( e.getMessage().compareTo("Crosswalk's APIs are not ready yet") == 0 ) {
        } else {
            throw e;
        }
    }
    return false;
}

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