android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • IMPACTED CASES: ========================================================================= Presentation Test REPRODUCE TEST STEPS: ========================================================================= Pre-condition: Turn on "Simulate secondary displays" on phone by Settings->Developer options->Simulate secondary displays 1. Download "webapi-usecase-tests-9.38.204.0-1.apk.zip"(see the url in comment). 2. Install "webapi-usecase-tests-9.38.204.0-1.apk" by: unzip webapi-usecase-tests-9.38.204.0-1.apk.zip adb install opt/webapi-usecase-tests/webapi-usecase-tests_x86.apk 3. Click the icon of the "webapi-usecase-tests" app, select "Presentation Test" TC, click "run" button. 4. Click "Request Show Presentation" button. EXPECTED OUTCOME: ========================================================================= an presention window should show on wireless display. ACTUAL OUTCOME: ========================================================================= "webapi_usecase_tests" app crashed. ISSUE ANALYSIS: ========================================================================= The logcat log as below: {code} 09-15 09:42:13.389: W/dalvikvm(7815): threadid=1: thread exiting with uncaught exception (group=0x41dc9930) 09-15 09:42:13.389: W/WindowManager(526): Attempted to add window with non-application token WindowToken{4263da70 null}. Aborting. E/AndroidRuntime(11182): FATAL EXCEPTION: main E/AndroidRuntime(11182): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application E/AndroidRuntime(11182): at android.view.ViewRootImpl.setView(ViewRootImpl.java:575) E/AndroidRuntime(11182): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246) E/AndroidRuntime(11182): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) E/AndroidRuntime(11182): at android.app.Dialog.show(Dialog.java:281) E/AndroidRuntime(11182): at android.app.Presentation.show(Presentation.java:235) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationViewJBMR1.show(PresentationViewJBMR1.java:28) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.updatePresentationView(PresentationExtension.java:395) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.access$1000(PresentationExtension.java:34) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension$2.run(PresentationExtension.java:295) E/AndroidRuntime(11182): at android.os.Handler.handleCallback(Handler.java:725) E/AndroidRuntime(11182): at android.os.Handler.dispatchMessage(Handler.java:92) E/AndroidRuntime(11182): at android.os.Looper.loop(Looper.java:152) E/AndroidRuntime(11182): at android.app.ActivityThread.main(ActivityThread.java:5132) E/AndroidRuntime(11182): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(11182): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(11182): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(11182): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(11182): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 2106): Force finishing activity org.xwalk.webapi_usecase_tests/.WebapiUsecaseTestsActivity {code} Test Case Sources Code: ========================================================================= || Type || URL || | Source Code | https://github.com/crosswalk-project/crosswalk-test-suite/blob/master/usecase/webapi-usecase-tests/tests/Presentation | TEST BUILDS: ========================================================================= ||Version||Test Date|| Test Device || Result || |Canary 9.38.199.0|2014.09.09| ZTE Geek V975 (IA) | {color:green}Pass{color} | |Canary 9.38.204.0|2014.09.15| ZTE Geek V975 (IA) | {color:red}Fail{color} |
    via by Jingya Cao,
  • IMPACTED CASES: ========================================================================= Presentation Test REPRODUCE TEST STEPS: ========================================================================= Pre-condition: Turn on "Simulate secondary displays" on phone by Settings->Developer options->Simulate secondary displays 1. Download "webapi-usecase-tests-9.38.204.0-1.apk.zip"(see the url in comment). 2. Install "webapi-usecase-tests-9.38.204.0-1.apk" by: unzip webapi-usecase-tests-9.38.204.0-1.apk.zip adb install opt/webapi-usecase-tests/webapi-usecase-tests_x86.apk 3. Click the icon of the "webapi-usecase-tests" app, select "Presentation Test" TC, click "run" button. 4. Click "Request Show Presentation" button. EXPECTED OUTCOME: ========================================================================= an presention window should show on wireless display. ACTUAL OUTCOME: ========================================================================= "webapi_usecase_tests" app crashed. ISSUE ANALYSIS: ========================================================================= The logcat log as below: {code} 09-15 09:42:13.389: W/dalvikvm(7815): threadid=1: thread exiting with uncaught exception (group=0x41dc9930) 09-15 09:42:13.389: W/WindowManager(526): Attempted to add window with non-application token WindowToken{4263da70 null}. Aborting. E/AndroidRuntime(11182): FATAL EXCEPTION: main E/AndroidRuntime(11182): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application E/AndroidRuntime(11182): at android.view.ViewRootImpl.setView(ViewRootImpl.java:575) E/AndroidRuntime(11182): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246) E/AndroidRuntime(11182): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) E/AndroidRuntime(11182): at android.app.Dialog.show(Dialog.java:281) E/AndroidRuntime(11182): at android.app.Presentation.show(Presentation.java:235) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationViewJBMR1.show(PresentationViewJBMR1.java:28) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.updatePresentationView(PresentationExtension.java:395) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.access$1000(PresentationExtension.java:34) E/AndroidRuntime(11182): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension$2.run(PresentationExtension.java:295) E/AndroidRuntime(11182): at android.os.Handler.handleCallback(Handler.java:725) E/AndroidRuntime(11182): at android.os.Handler.dispatchMessage(Handler.java:92) E/AndroidRuntime(11182): at android.os.Looper.loop(Looper.java:152) E/AndroidRuntime(11182): at android.app.ActivityThread.main(ActivityThread.java:5132) E/AndroidRuntime(11182): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(11182): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(11182): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(11182): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(11182): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 2106): Force finishing activity org.xwalk.webapi_usecase_tests/.WebapiUsecaseTestsActivity {code} Test Case Sources Code: ========================================================================= || Type || URL || | Source Code | https://github.com/crosswalk-project/crosswalk-test-suite/blob/master/usecase/webapi-usecase-tests/tests/Presentation | TEST BUILDS: ========================================================================= ||Version||Test Date|| Test Device || Result || |Canary 9.38.199.0|2014.09.09| ZTE Geek V975 (IA) | {color:green}Pass{color} | |Canary 9.38.204.0|2014.09.15| ZTE Geek V975 (IA) | {color:red}Fail{color} |
    via by Jingya Cao,
  • Impacted Cases ============== Developers attempting to make use of the presentation API. Reproduce Test Steps ==================== 1. Unzip the attached file 2. Package the unzipped application using make_apk.py: {code} python make_apk.py --manifest=app/manifest.json --package=foo.elliot --name=secondscreen --enable-remote-debugging {code} 3. Install on Android device. 4. Put wireless adapter into TV, turn on correct HDMI channel etc. 5. Connect Android device to wireless display adapter. 6. Start application; second screen is shown to be connected. I also see the tablet's screen displayed on the second screen, as expected. 7. Attempt to open the image-display.html page on the second screen by tapping an image on the tablet's screen. Expected Outcome ================ HTML page opens on second screen. Actual Outcome ============== Application crashes with an "Application has stopped unexpectedly" message. Test Case Source Code ===================== See attached file. Test Builds =========== N/A Issue Analysis ============== The adb logcat output around the time of the crash is as follows: {code} W/WindowManager( 558): Attempted to add window with non-application token WindowToken{427376f8 null}. Aborting. E/AndroidRuntime(13507): FATAL EXCEPTION: main E/AndroidRuntime(13507): Process: foo.elliot, PID: 13507 E/AndroidRuntime(13507): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application E/AndroidRuntime(13507): at android.view.ViewRootImpl.setView(ViewRootImpl.java:536) E/AndroidRuntime(13507): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) E/AndroidRuntime(13507): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) E/AndroidRuntime(13507): at android.app.Dialog.show(Dialog.java:286) E/AndroidRuntime(13507): at android.app.Presentation.show(Presentation.java:235) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationViewJBMR1.show(PresentationViewJBMR1.java:28) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.updatePresentationView(PresentationExtension.java:395) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.access$1000(PresentationExtension.java:34) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension$2.run(PresentationExtension.java:295) E/AndroidRuntime(13507): at android.os.Handler.handleCallback(Handler.java:733) E/AndroidRuntime(13507): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime(13507): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime(13507): at android.app.ActivityThread.main(ActivityThread.java:5001) E/AndroidRuntime(13507): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(13507): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(13507): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) E/AndroidRuntime(13507): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) E/AndroidRuntime(13507): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 558): Force finishing activity foo.elliot/.ElliotActivity D/dalvikvm(13507): GC_CONCURRENT freed 322K, 4% free 9437K/9796K, paused 1ms+2ms, total 32ms W/ActivityManager( 558): Activity pause timeout for ActivityRecord{42250470 u0 foo.elliot/.ElliotActivity t75 f} I/Process (13507): Sending signal. PID: 13507 SIG: 9 I/ActivityManager( 558): Process foo.elliot (pid 13507) has died. I/WindowState( 558): WIN DEATH: Window{42ce6df0 u0 SurfaceView} I/WindowState( 558): WIN DEATH: Window{42aeaa98 u0 foo.elliot/foo.elliot.ElliotActivity} {code}
    via by Elliot Smith,
  • Impacted Cases ============== Developers attempting to make use of the presentation API. Reproduce Test Steps ==================== 1. Unzip the attached file 2. Package the unzipped application using make_apk.py: {code} python make_apk.py --manifest=app/manifest.json --package=foo.elliot --name=secondscreen --enable-remote-debugging {code} 3. Install on Android device. 4. Put wireless adapter into TV, turn on correct HDMI channel etc. 5. Connect Android device to wireless display adapter. 6. Start application; second screen is shown to be connected. I also see the tablet's screen displayed on the second screen, as expected. 7. Attempt to open the image-display.html page on the second screen by tapping an image on the tablet's screen. Expected Outcome ================ HTML page opens on second screen. Actual Outcome ============== Application crashes with an "Application has stopped unexpectedly" message. Test Case Source Code ===================== See attached file. Test Builds =========== N/A Issue Analysis ============== The adb logcat output around the time of the crash is as follows: {code} W/WindowManager( 558): Attempted to add window with non-application token WindowToken{427376f8 null}. Aborting. E/AndroidRuntime(13507): FATAL EXCEPTION: main E/AndroidRuntime(13507): Process: foo.elliot, PID: 13507 E/AndroidRuntime(13507): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application E/AndroidRuntime(13507): at android.view.ViewRootImpl.setView(ViewRootImpl.java:536) E/AndroidRuntime(13507): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) E/AndroidRuntime(13507): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) E/AndroidRuntime(13507): at android.app.Dialog.show(Dialog.java:286) E/AndroidRuntime(13507): at android.app.Presentation.show(Presentation.java:235) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationViewJBMR1.show(PresentationViewJBMR1.java:28) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.updatePresentationView(PresentationExtension.java:395) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.access$1000(PresentationExtension.java:34) E/AndroidRuntime(13507): at org.xwalk.core.internal.extension.api.presentation.PresentationExtension$2.run(PresentationExtension.java:295) E/AndroidRuntime(13507): at android.os.Handler.handleCallback(Handler.java:733) E/AndroidRuntime(13507): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime(13507): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime(13507): at android.app.ActivityThread.main(ActivityThread.java:5001) E/AndroidRuntime(13507): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(13507): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(13507): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) E/AndroidRuntime(13507): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) E/AndroidRuntime(13507): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 558): Force finishing activity foo.elliot/.ElliotActivity D/dalvikvm(13507): GC_CONCURRENT freed 322K, 4% free 9437K/9796K, paused 1ms+2ms, total 32ms W/ActivityManager( 558): Activity pause timeout for ActivityRecord{42250470 u0 foo.elliot/.ElliotActivity t75 f} I/Process (13507): Sending signal. PID: 13507 SIG: 9 I/ActivityManager( 558): Process foo.elliot (pid 13507) has died. I/WindowState( 558): WIN DEATH: Window{42ce6df0 u0 SurfaceView} I/WindowState( 558): WIN DEATH: Window{42aeaa98 u0 foo.elliot/foo.elliot.ElliotActivity} {code}
    via by Elliot Smith,
  • GitHub comment 718#168185028
    via GitHub by thestinger
    ,
    • android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRootImpl.setView(ViewRootImpl.java:575) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at android.app.Dialog.show(Dialog.java:281) at android.app.Presentation.show(Presentation.java:235) at org.xwalk.core.internal.extension.api.presentation.PresentationViewJBMR1.show(PresentationViewJBMR1.java:28) at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.updatePresentationView(PresentationExtension.java:395) at org.xwalk.core.internal.extension.api.presentation.PresentationExtension.access$1000(PresentationExtension.java:34) at org.xwalk.core.internal.extension.api.presentation.PresentationExtension$2.run(PresentationExtension.java:295) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:152) at android.app.ActivityThread.main(ActivityThread.java:5132) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

    Unknown User
    Unknown User6 times, last one,
    Indri Yunita
    Indri Yunita4 times, last one,
    filpgame
    filpgame2 times, last one,
    Unknown visitor2 times, last one,
    Adrien
    Adrien1 times, last one,
    52 more bugmates