New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exception throwed when cordovaActivity destroy #1000
Comments
Please provide version info. You can find this information via the following commands:
Thank you. |
Sorry, our project is relatively old, and it has been handed over many times by many people. At present, we only have the source code of the cordova framework and various plugins, and there is no complete Cordova environment and configuration. What is certain is that the PLATFORM_VERSION_BUILD_LABEL in cordova.js we use is 5.1.1, which corresponds to Installed platforms. Other information is unclear. (The version information of the camera plug-in is "cordova-plugin-camera 4.1.0 "Camera"". Although this information should be useless, it is still provided to you). I also read the relevant information before asking the question, I am not sure that the new version fixes the problem. Thank you. |
In a case like that I would strongly recommend the following ideas:
In short, try one thing at a time to make a minimal, reproducible example. |
I'd also like to add that cordova-android 5.1.1 is extremely dated and will likely not work with modern sdk versions. It certainly wouldn't pass Google's Play expectations. |
It's a bit embarrassing. Under the latest Cordova project(a demo), I destroy the Cordova page and still report that exception. However, I found that my previous inference was not true, that is, Cordova's closing affected the setflag setting of the next page. 2020-06-17 16:04:22.328 15867-15867/i W/cr_AwContents: Application attempted to call on a destroyed WebView what a strange thing is the phenomenon below is still exist in my app,but not in the demo |
Can confirm that. cordova-android 9.0.0 with android 9.0.0, targetSdk set to 29 or 30 (reproduced on both), but bug is there on all devices starting with API 24+ (didn't test for lower) Commenting out the line that @zhqcqupt mentioned makes that exception disappear. Is there a less hacky way though to bypass it? |
cordova-android/framework/src/org/apache/cordova/CordovaWebViewImpl.java Lines 508 to 509 in 97e2d15
Wonder if that TODO applies here... 🤔 Perhaps it's a race condition. |
Closing as stale |
Bug Report
Problem
In Android,we use cordova to load url ,but when activity.finish() is called ,a exception throws ,that is
Application attempted to call on a destroyed WebView java.lang.Throwable.
According to my analysis, this exception affected some behavior of my next activity, such as calling activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
I found the cordova code where the exception was thrown (CordovaWebviewImpl#handleDestroy) and commented out the code that caused the exception (this.loadUrl("about:blank");). There will be no above problems, and my setFlags function normally
What is expected to happen?
with no exception throws when CordovaActivity destroy
What does actually happen?
see above
Information
Application attempted to call on a destroyed WebView
java.lang.Throwable
at org.chromium.android_webview.AwContents.a(PG:124)
at com.android.webview.chromium.WebViewChromium.loadUrl(PG:11)
at java.lang.reflect.Method.invoke(Native Method)
at com.msmsdk.hook.javaHook.serverhook.WebViewHook$WebViewProviderHandler.invoke(WebViewHook.java:114)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy3.loadUrl(Unknown Source)
at android.webkit.WebView.loadUrl(WebView.java:741)
at org.apache.cordova.engine.SystemWebViewEngine.loadUrl(SystemWebViewEngine.java:272)
at org.apache.cordova.CordovaWebViewImpl.loadUrlIntoView(CordovaWebViewImpl.java:129)
at org.apache.cordova.CordovaWebViewImpl.loadUrl(CordovaWebViewImpl.java:198)
at org.apache.cordova.CordovaWebViewImpl.handleDestroy(CordovaWebViewImpl.java:490)
at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:344)
at [myActivityPath].CordovaMainActivity.onDestroy(CordovaMainActivity.java:1210)
at android.app.Activity.performDestroy(Activity.java:8350)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1348)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5552)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5597)
at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
Command or Code
Environment, Platform, Device
Android HuaWei p10Pro
Version information
Checklist
The text was updated successfully, but these errors were encountered: