Skip to content
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

Android: Evothings Viewer craches #26

Open
ghost opened this issue Nov 15, 2016 · 7 comments
Open

Android: Evothings Viewer craches #26

ghost opened this issue Nov 15, 2016 · 7 comments

Comments

@ghost
Copy link

ghost commented Nov 15, 2016

Reported on Evothings Gitter channel: https://gitter.im/evothings/evothings

https://gitter.im/evothings/evothings?at=582901e0e462097a30458f60

I am having a problem with my Evothings Viewer on an Android device. It 'crashes' periodically (can find no pattern to this yet) and I have tried uninstalling and reinstalling, forced stop, clearing caches and data, but nothing except resetting my device to factory settings seems to work. The viewer shows a blank screen and then shuts down. This has been happening with the app downloaded from Google Play, rebuilding from source or building a custom one.

https://gitter.im/evothings/evothings?at=582a4a2d65485ebc6796f34f

My app calls the ble plugin, camera, dialogs and cordova-http of the standard ones. My own viewer also includes file, file-transfer, cordova-httpd, social sharing and secure storage. The android version is 5.0.1. The app crashes at start up - it does not even present the "connect" page. I will work on getting the logcat and post.

the device is a Lenovo Tab3 7

From logcat:

E/StrictMode(21320): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E/StrictMode(21320): java.lang.Throwable: Explicit termination method 'close' not called
E/StrictMode(21320):     at dalvik.system.CloseGuard.open(CloseGuard.java:184)
E/StrictMode(21320):     at java.io.RandomAccessFile.<init>(RandomAccessFile.java:127)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromiumFactoryProvider.startChromiumLocked(WebViewChromiumFactoryProvider.java:16107)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromiumFactoryProvider.ensureChromiumStartedLocked(WebViewChromiumFactoryProvider.java:333)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromiumFactoryProvider.startYourEngines(WebViewChromiumFactoryProvider.java:427)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:162)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:580)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:515)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:498)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:485)
E/StrictMode(21320):     at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:47)
E/StrictMode(21320):     at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:43)
E/StrictMode(21320):     at org.apache.cordova.engine.SystemWebViewEngine.<init>(SystemWebViewEngine.java:75)
E/StrictMode(21320):     at com.evothings.evothingsviewer.MainActivity$EvothingsWebViewEngine.<init>(MainActivity.java:165)
E/StrictMode(21320):     at com.evothings.evothingsviewer.MainActivity.makeWebViewEngine(MainActivity.java:154)
E/StrictMode(21320):     at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:192)
E/StrictMode(21320):     at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:141)
E/StrictMode(21320):     at com.evothings.evothingsviewer.MainActivity.onCreate(MainActivity.java:71)
E/StrictMode(21320):     at android.app.Activity.performCreate(Activity.java:6041)
E/StrictMode(21320):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
E/StrictMode(21320):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
E/StrictMode(21320):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2564)
E/StrictMode(21320):     at android.app.ActivityThread.access$800(ActivityThread.java:170)
E/StrictMode(21320):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
E/StrictMode(21320):     at android.os.Handler.dispatchMessage(Handler.java:111)
E/StrictMode(21320):     at android.os.Looper.loop(Looper.java:194)
E/StrictMode(21320):     at android.app.ActivityThread.main(ActivityThread.java:5576)
E/StrictMode(21320):     at java.lang.reflect.Method.invoke(Native Method)
E/StrictMode(21320):     at java.lang.reflect.Method.invoke(Method.java:372)
E/StrictMode(21320):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
E/StrictMode(21320):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
W/System.err(21320): StrictMode VmPolicy violation with POLICY_DEATH; shutting down.
@ghost
Copy link
Author

ghost commented Nov 15, 2016

Some observations:

The part of logcat shown above indicates that the origin is here:

https://android.googlesource.com/platform/libcore-snapshot/+/ics-mr1/luni/src/main/java/java/io/RandomAccessFile.java#128

The random access file seems to be opened by the WebView code.

The viewer source code in MainActivity.java does not seem to open Closables (except for the caching code, which is currently not used or called to my knowledge).

Could the error be caused by any of the plugins added? Have not seen this error in the "plain" Viewer.

@tmac2470
Copy link

As reported on Evothings Gitter channel, this error seems to occur with a custom version of the viewer (including the additional plugins), a viewer built from source project (with no additional plugins) and the one downloaded from the app store. The Viewer will work for a few hours and then crash. Once any version has crashed it will not start up again until the device factory settings have been restored ( with selection to not use a backed up version to restore). The full logcat output is attached.

crash_original_log_15112016_id_removed.txt

@tmac2470
Copy link

UPDATE: This error seems to be caused by latest Android System Webview updates on my device. Uninstalling the updates has resulted in the viewer being stable.

@ghost
Copy link
Author

ghost commented Nov 24, 2016

@tmac2470 Thanks a lot for reporting! Closing this issue for now. Let me know if to reopen.

@ghost ghost closed this as completed Nov 24, 2016
@gokr
Copy link
Contributor

gokr commented Dec 29, 2016

I am fairly sure this is a pure Android WebView bug (not Evothings or Cordova related), as reported here:

https://code.google.com/p/android/issues/detail?id=226751

It seems to manifest itself on only on later Android versions and I also found this quote implying that API 25 has changed to fix it:

"I've been having the same issue, and it looks like it's a bug in API < 25. Try your program in an emulator with API 25 and see if it works. If it works there, then it is most likely the same problem and you are out of luck until is able to fix the issue."

Currently Cordova-android uses Android API 14-23: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html

...so not sure how we can fix this?

@gokr gokr reopened this Dec 29, 2016
@ghost
Copy link
Author

ghost commented Dec 29, 2016

One approach to solve the WebView issue could be to use Crosswalk: https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview

@perttikasanenhitseed
Copy link

This probably was ie to some old setup of the viewer souce. One that updates did not fix. Using the Studio 2.2 build or creating a new project with cordova seemed to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants