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

Toast doesn't display on 1.6.1 #1062

Closed
eygraber opened this issue Jul 24, 2018 · 6 comments
Closed

Toast doesn't display on 1.6.1 #1062

eygraber opened this issue Jul 24, 2018 · 6 comments
Milestone

Comments

@eygraber
Copy link
Contributor

After updating to 1.6.1 I see notifications saying that a leak was detected, and is being analyzed, etc... but there is no Toast that pops up saying the app is freezing...

@pyricau
Copy link
Member

pyricau commented Jul 24, 2018

Can you reproduce this systematically, in the sample app? If yes, can you provide the Android version you're using?

@eygraber
Copy link
Contributor Author

Will try in the sample app.

@eygraber
Copy link
Contributor Author

Just confirmed that this happens in the sample app. I'm using a Pixel 2 on Android 8.1.0

@pyricau
Copy link
Member

pyricau commented Jul 25, 2018

Thanks

@eygraber
Copy link
Contributor Author

This is printed when a leak is detected:

D/LeakCanary: Could not show leak toast, the window token has been canceled
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
        at android.view.ViewRootImpl.setView(ViewRootImpl.java:765)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
        at com.squareup.leakcanary.AndroidHeapDumper.show(AndroidHeapDumper.java:148)
        at com.squareup.leakcanary.AndroidHeapDumper.access$100(AndroidHeapDumper.java:43)
        at com.squareup.leakcanary.AndroidHeapDumper$1.run(AndroidHeapDumper.java:100)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@Testencio
Copy link

I can confirm this. I got the same exception.

pyricau added a commit that referenced this issue Aug 5, 2018
- We now have a notification for all the stages of leak detection, including heap dumping
- Using proper Android toasts crashes in recent Android versions (#844)
- Custom Toast display doesn't work on recent Android versions (#1062)
- The toast was also annoying if the app isn't in the foreground (#1069)
- Waiting for the toast to display was done by waiting for main thread idle which added an unnecessary delay.

Fixes #1062
Fixes #1069
@pyricau pyricau added this to the Next release milestone Oct 16, 2018
@pyricau pyricau closed this as completed Oct 16, 2018
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