You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/06/19 08:37:14 UTC

[GitHub] [cordova-android] secondVISION opened a new issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

secondVISION opened a new issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   Cordova should silently exit.
   
   
   ### What does actually happen?
   Cordova crashes because the parent Activity is not alive anymore
   
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   Start a CordovaWebview and load a slow/large website.
   
   `cordovaWebView.loadUrl(url)`
   
   If you return to the previous activity (by using the (hardware) back button), cordova will try to execute `cordova.getActivity().runOnUiThread()`, but the activity is no longer there.
   
   e.g., https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaWebViewImpl.java#L187
   
   Stacktrace:
   ```
   java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference
           at org.apache.cordova.CordovaWebViewImpl$2.run(CordovaWebViewImpl.java:179)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
           at java.lang.Thread.run(Thread.java:764)
   ```
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   See information above on how to reproduce.
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Android / All devices / All OS
   
   
   ### Version information
   <!--
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Android Studio 
   Cordova 8.1.0
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X ] I searched for existing GitHub issues:
   - Found issue: https://github.com/apache/cordova-android/issues/884 but this was closed due to lack of information
   - [X] I updated all Cordova tooling to most recent version:
   - Crash occured on 
       'org.apache.cordova:cordova:6.2.3'
   Updated to (crashed as well):
       'org.apache.cordova:framework:8.1.0'
   - [X ] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] jaeheonshim commented on issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
jaeheonshim commented on issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002#issuecomment-650451238


   You should be able to replicate the problem by enabling the "Don't keep activities" option in Android Developer Options (Developer options => Apps => Don't keep activities (Destroy every activity as soon as the user leaves it.)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] jcesarmobile commented on issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002#issuecomment-648767171


   can you provide a sample app?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] jaeheonshim edited a comment on issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
jaeheonshim edited a comment on issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002#issuecomment-650451238


   You should be able to replicate the problem by enabling the "Don't keep activities" option in Android Developer Options (Developer options => Apps => Don't keep activities (Destroy every activity as soon as the user leaves it.))


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] breautek commented on issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002#issuecomment-650467372


   When doing that on the android simulator, I run into a different crash stacktrace
   
   ```
   D/CordovaActivity: Paused the activity.
   D/CordovaActivity: Stopped the activity.
   D/CordovaActivity: CordovaActivity.onDestroy()
   D/CordovaWebViewImpl: >>> loadUrl(about:blank)
   W/cr_AwContents: WebView.destroy() called while WebView is still attached to window.
   W/cr_AwContents: Application attempted to call on a destroyed WebView
       java.lang.Throwable
           at org.chromium.android_webview.AwContents.t(chromium-TrichromeWebViewGoogle.apk-stable-410404481:2)
           at Mt.loadingStateChanged(chromium-TrichromeWebViewGoogle.apk-stable-410404481:2)
           at android.os.MessageQueue.nativePollOnce(Native Method)
           at android.os.MessageQueue.next(MessageQueue.java:335)
           at android.os.Looper.loop(Looper.java:183)
           at android.app.ActivityThread.main(ActivityThread.java:7523)
           at java.lang.reflect.Method.invoke(Native Method)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
   E/chromium: [ERROR:aw_browser_terminator.cc(125)] Renderer process (5916) crash detected (code -1).
   ```
   
   Maybe this depends on the API level of the device and/or the installed chrome version though. It kinda seems related.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] secondVISION commented on issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
secondVISION commented on issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002#issuecomment-659976191


   
   ![cordovacrashgif](https://user-images.githubusercontent.com/8403152/87768592-aae51200-c81c-11ea-8b57-260b6131c09b.gif)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] secondVISION commented on issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
secondVISION commented on issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002#issuecomment-659912485


   Created a sample app: https://github.com/secondVISION/cordova-android-crash
   
   How to reproduce:
   - Click on "Start Cordova"
   - Immediately press the Back key
   - Wait on crash. Cordova will try to load the website in an activity which has already been destroyed.
     - Waiting can take up to 30 seconds I've noticed
   
   Crash log:
   ```
   2020-07-16 14:06:20.618 19256-19392/com.example.cordovacrash D/EGL_emulation: eglMakeCurrent: 0x8c152aa0: ver 3 0 (tinfo 0x8859b8c0)
   2020-07-16 14:06:39.652 19256-19383/com.example.cordovacrash E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
       Process: com.example.cordovacrash, PID: 19256
       java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference
           at org.apache.cordova.CordovaWebViewImpl$2.run(CordovaWebViewImpl.java:181)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
           at java.lang.Thread.run(Thread.java:764)
   2020-07-16 14:06:39.819 19256-19310/com.example.cordovacrash D/EGL_emulation: eglMakeCurrent: 0xa1305300: ver 3 0 (tinfo 0xa13031f0)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] breautek closed issue #1002: NullPointerException: 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

Posted by GitBox <gi...@apache.org>.
breautek closed issue #1002:
URL: https://github.com/apache/cordova-android/issues/1002


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org