cordova-crosswalk-engine icon indicating copy to clipboard operation
cordova-crosswalk-engine copied to clipboard

Cordova App Crash when using xwalk plugin

Open snese opened this issue 8 years ago • 3 comments

Hi guys,

Env.

  • cordova#6.0.0
  • angular#1.4.3
  • ionic#1.2.4
  • android studio#1.5.1

Test Device

  • Samsung S6#5.1.1

I add file "gradle.properties" in the platform/android that content is android.useDeprecatedNdk=true to avoid build error.

When app build success and ready to star that crash happened.

key meesage: java.lang.ClassCastException: org.crosswalk.engine.XWalkCordovaView cannot be cast to android.webkit.WebView

Any idea about this ?

detail log: 03-22 10:00:33.323 16484-16484/? E/AndroidRuntime: FATAL EXCEPTION: main Process: ttt.apps.www.np, PID: 16484 java.lang.RuntimeException: Unable to start activity ComponentInfo{ttt.apps.www.np/tt.apps.www.np.MainActivity}: java.lang.ClassCastException: org.crosswalk.engine.XWalkCordovaView cannot be cast to android.webkit.WebView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3119) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218) at android.app.ActivityThread.access$1000(ActivityThread.java:198) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6837) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by: java.lang.ClassCastException: org.crosswalk.engine.XWalkCordovaView cannot be cast to android.webkit.WebView at ttt.apps.www.np.MainActivity.onCreate(MainActivity.java:83) at android.app.Activity.performCreate(Activity.java:6500) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)  at android.app.ActivityThread.access$1000(ActivityThread.java:198)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:145)  at android.app.ActivityThread.main(ActivityThread.java:6837)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 

snese avatar Mar 22 '16 02:03 snese

It looks like your activity is straight up trying to cast the Crosswalk view as a WebView, which is something that Cordova doesn't do. Do you have any custom Java code in your MainActivity.java class? It looks very suspicious, since the stack trace doesn't include any Cordova classes whatsoever.

infil00p avatar Mar 22 '16 05:03 infil00p

BTW: This is my fork of the plugin, not the main repository.

infil00p avatar Mar 22 '16 05:03 infil00p

@infil00p Get it! Thanks for your reply

snese avatar Mar 22 '16 06:03 snese