Skip to content

有关cordova框架作为插件接入,报错:Faild create webview #1175

@senda58

Description

@senda58

详细的报错信息如下:

Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Failed to create webview.
at com.tencent.shadow.core.loader.delegates.ShadowActivityDelegate.onCreate(ShadowActivityDelegate.kt:159)
at com.tencent.shadow.core.runtime.container.PluginContainerActivity.onCreate(PluginContainerActivity.java:85)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7356) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 
Caused by: java.lang.RuntimeException: Failed to create webview.
at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:84)
at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:209)
at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:205)
at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:149)
at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:227)
at com.example.hello.MainActivity.onCreate(MainActivity.java:39)
at com.tencent.shadow.core.loader.delegates.ShadowActivityDelegate.onCreate(ShadowActivityDelegate.kt:156)
at com.tencent.shadow.core.runtime.container.PluginContainerActivity.onCreate(PluginContainerActivity.java:85) 
at android.app.Activity.performCreate(Activity.java:7802) 
at android.app.Activity.performCreate(Activity.java:7791) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7356) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:82)
at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:209) 
at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:205) 
at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:149) 
at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:227) 
at com.example.hello.MainActivity.onCreate(MainActivity.java:39) 
at com.tencent.shadow.core.loader.delegates.ShadowActivityDelegate.onCreate(ShadowActivityDelegate.kt:156) 
at com.tencent.shadow.core.runtime.container.PluginContainerActivity.onCreate(PluginContainerActivity.java:85) 
at android.app.Activity.performCreate(Activity.java:7802) 
at android.app.Activity.performCreate(Activity.java:7791) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7356) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 
Caused by: java.lang.ClassCastException: android.webkit.WebViewClient cannot be cast to org.apache.cordova.engine.SystemWebViewClient
at org.apache.cordova.engine.SystemWebView.setWebViewClient(SystemWebView.java:70)
at com.tencent.shadow.core.runtime.ShadowWebView.init(ShadowWebView.java:82)
at com.tencent.shadow.core.runtime.ShadowWebView.(ShadowWebView.java:61)

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR welcome欢迎贡献代码bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions