Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3158] Android: Activity indicator crashes app with "is your activity running?"

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-09-29T11:52:39.000+0000
Affected Version/sRelease 1.7.0, Release 1.6.2
Fix Version/sSprint 2011-31, Release 1.7.3, Release 1.8.0
ComponentsAndroid
Labelsverified-1.7.3
ReporterThomas Huelbert
AssigneeVikramjeet Singh
Created2011-04-15T03:38:18.000+0000
Updated2011-09-29T11:52:39.000+0000

Description

split off from #3099. Seen on a nexus s (2.3.1) running [INFO] Titanium SDK version: 1.6.0 (02/08/11 20:55 bd9d124...)

1.Mashups > YQL > YQL + Flickr

results: intermittent crash - pastie here: http://pastie.org/1550070">http://pastie.org/1550070

E/TiUncaughtHandler( 7825): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@40512ad8 is not valid; is your activity running?

Comments

  1. Mike Robinson 2011-04-15

    I've been having this error in my own code a lot! I have mitigated it some by reducing the number of activity indicators I am using and checking that the current activity is the same one as the one that the activity indicator will be created from. Very annoying as I use activity indicators a lot.

    Perhaps this link will help the developers.
    http://dimitar.me/android-displaying-dialogs-from-background-threads/"> http://dimitar.me/android-displaying-dialogs-from-background-threads/

  2. Dawson Toth 2011-04-29

    Reproduction

    I have a solid reproduction of this using activity indicators on Android here: https://gist.github.com/370939b6e54dadf6f5a9 Using that sample code, follow the on screen instructions and it should crash every time.

    Tested On

    Samsung Epic 4G 2.2 BROKEN on 1.7.0 (04/05/11 10:30 731db9c...) BROKEN on 1.6.2 (03/30/11 17:25 0243d42...) BROKEN on 1.6.1 (03/09/11 10:58 6d9b0f3...)

    Crash Log

       
       W/InputManagerService( 2450): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@484f2b28 (uid=10029 pid=18019)
       V/InputDevice( 2450): ID[0]=0(0) Dn(0=>1)
       V/WindowManager( 2450): Dsptch > Window{485a8c58 com.fede.launcher/com.fede.launcher.Launcher paused=false}
       V/WindowManager( 2450): Dsptch > Window{485a8c58 com.fede.launcher/com.fede.launcher.Launcher paused=false}
       V/InputDevice( 2450): ID[0]=0(0) Up(1=>0)
       I/ActivityManager( 2450): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.dawson.playgroundmobile/.PlaygroundmobileActivity bnds=[365,58][475,188] }
       V/InputDevice( 2450): ID[0]=0(0) Dn(0=>1)
       V/WindowManager( 2450): Dsptch > Window{48647550 com.dawson.playgroundmobile/org.appcelerator.titanium.TiActivity paused=false}
       V/InputDevice( 2450): ID[0]=0(0) Up(1=>0)
       V/WindowManager( 2450): Dsptch > Window{48647550 com.dawson.playgroundmobile/org.appcelerator.titanium.TiActivity paused=false}
       E/TiUIView(18300): (main) [3425,11059] TAP, TAP, TAP on [Ti.UI.Button]
       D/AndroidRuntime(18300): Shutting down VM
       W/dalvikvm(18300): threadid=1: thread exiting with uncaught exception (group=0x4001d7f0)
       W/WindowManager( 2450): Attempted to add application window with unknown token HistoryRecord{487b0e18 com.dawson.playgroundmobile/.ShareActivityActivity}.  Aborting.
       E/TiUncaughtHandler(18300): (main) [158,11217] Sending event: exception on thread: main msg:android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@482f8eb8 is not valid; is your activity running?; Titanium 1.6.1,2011/03/09 10:58,d9b0f3...
       E/TiUncaughtHandler(18300): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@482f8eb8 is not valid; is your activity running?
       E/TiUncaughtHandler(18300): 	at android.view.ViewRoot.setView(ViewRoot.java:505)
       E/TiUncaughtHandler(18300): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
       E/TiUncaughtHandler(18300): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
       E/TiUncaughtHandler(18300): 	at android.view.Window$LocalWindowManager.addView(Window.java:424)
       E/TiUncaughtHandler(18300): 	at android.app.Dialog.show(Dialog.java:241)
       E/TiUncaughtHandler(18300): 	at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200)
       E/TiUncaughtHandler(18300): 	at ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124)
       E/TiUncaughtHandler(18300): 	at ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:45)
       E/TiUncaughtHandler(18300): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:212)
       E/TiUncaughtHandler(18300): 	at android.os.Handler.dispatchMessage(Handler.java:95)
       E/TiUncaughtHandler(18300): 	at android.os.Looper.loop(Looper.java:123)
       E/TiUncaughtHandler(18300): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
       E/TiUncaughtHandler(18300): 	at java.lang.reflect.Method.invokeNative(Native Method)
       E/TiUncaughtHandler(18300): 	at java.lang.reflect.Method.invoke(Method.java:521)
       E/TiUncaughtHandler(18300): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
       E/TiUncaughtHandler(18300): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
       E/TiUncaughtHandler(18300): 	at dalvik.system.NativeStart.main(Native Method)
       E/AndroidRuntime(18300): FATAL EXCEPTION: main
       E/AndroidRuntime(18300): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@482f8eb8 is not valid; is your activity running?
       E/AndroidRuntime(18300): 	at android.view.ViewRoot.setView(ViewRoot.java:505)
       E/AndroidRuntime(18300): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
       E/AndroidRuntime(18300): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
       E/AndroidRuntime(18300): 	at android.view.Window$LocalWindowManager.addView(Window.java:424)
       E/AndroidRuntime(18300): 	at android.app.Dialog.show(Dialog.java:241)
       E/AndroidRuntime(18300): 	at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200)
       E/AndroidRuntime(18300): 	at ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124)
       E/AndroidRuntime(18300): 	at ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:45)
       E/AndroidRuntime(18300): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:212)
       E/AndroidRuntime(18300): 	at android.os.Handler.dispatchMessage(Handler.java:95)
       E/AndroidRuntime(18300): 	at android.os.Looper.loop(Looper.java:123)
       E/AndroidRuntime(18300): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
       E/AndroidRuntime(18300): 	at java.lang.reflect.Method.invokeNative(Native Method)
       E/AndroidRuntime(18300): 	at java.lang.reflect.Method.invoke(Method.java:521)
       E/AndroidRuntime(18300): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
       E/AndroidRuntime(18300): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
       E/AndroidRuntime(18300): 	at dalvik.system.NativeStart.main(Native Method)
       I/        ( 2450): dumpmesg > "/data/log/dumpstate_app_error.log"
       W/ActivityManager( 2450):   Force finishing activity com.dawson.playgroundmobile/org.appcelerator.titanium.TiActivity
       W/ActivityManager( 2450): Activity pause timeout for HistoryRecord{48cd00b8 com.dawson.playgroundmobile/org.appcelerator.titanium.TiActivity}
       
  3. Dawson Toth 2011-04-29

    Associated Helpdesk Ticket

    http://appc.me/c/APP-935438
  4. Eduardo Gomez 2011-07-06

    Associated Helpdesk Ticket

    Another customer relies on this, http://appc.me/c/APP-935438 Whenever the app has been relaunched and attempts to show an activity indicator, this exception is produced.

    Environment Target

    {noformat} + **Product**: Mobile + **Titanium SDK**: Mobile 1.7.1 + **Platform OS**: Android + **Platform OS Version**: 2.1+ {noformat}

    Crash Log

    {noformat} android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@405162b8 is not valid; is your activity running? at android.view.ViewRoot.setView(ViewRoot.java:527) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.view.Window$LocalWindowManager.addView(Window.java:465) at android.app.Dialog.show(Dialog.java:241) at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200) at ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124) at ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:44) at org.appcelerator.titanium.proxy.TiViewProxy.show(TiViewProxy.java:473) at ti.modules.titanium.ui.TiDialogProxy.access$001(TiDialogProxy.java:13) at ti.modules.titanium.ui.TiDialogProxy$1.onCurrentActivityReady(TiDialogProxy.java:31) at org.appcelerator.titanium.util.TiUIHelper$4.onPostOpen(TiUIHelper.java:152) at org.appcelerator.titanium.proxy.TiWindowProxy$1.run(TiWindowProxy.java:278) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3835) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) at dalvik.system.NativeStart.main(Native Method) {noformat}
  5. Ben Bahrenburg 2011-08-03

    Same (or similar ) issue happens with Titanium.UI.createAlertDialog
  6. Bill Dawson 2011-08-05

    Merged fix to both 1_7_X and master. Verified Dawson's test doesn't fail in 1_7_X or master.
  7. Vikramjeet Singh 2011-09-13

    Resolved. Tested on: Mac OSX Lion TiMob: 1.8.0.v20110906155354 TiStud: 1.0.5.201109091616 Devices Used: Android Emulator 2.2 Droid3 Google Nexus S
  8. Eric Merriman 2011-09-29

    Verified fixed with OSX 10.6.8, Titanium Studio, build: 1.0.5.201109261308, SDK 1.7.3.v20110928185013, Emulator and Nexus S 2.3.4 using Dawson's sample code. Reclosing.

JSON Source