Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Error when screengrab is made in a Material Dialog #82

Closed
digobaptista opened this issue Feb 26, 2016 · 7 comments
Closed

Error when screengrab is made in a Material Dialog #82

digobaptista opened this issue Feb 26, 2016 · 7 comments
Assignees
Labels

Comments

@digobaptista
Copy link

I am having an issue screen grabbing when a Material Dialog (https://github.com/afollestad/material-dialogs) is shown. Here is the detailed log:

[17:04:16]: ▸ com.xxx.xxx.Test:..
[17:04:16]: ▸ Error in shouldXXX(com.xxx.xxx.Test):
[17:04:16]: ▸ java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
[17:04:16]: ▸ at tools.fastlane.screengrab.Screengrab$1.perform(Screengrab.java:77)
[17:04:16]: ▸ at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:144)
[17:04:16]: ▸ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
[17:04:16]: ▸ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
[17:04:16]: ▸ at android.os.Handler.handleCallback(Handler.java:739)
[17:04:16]: ▸ at android.os.Handler.dispatchMessage(Handler.java:95)
[17:04:16]: ▸ at android.os.Looper.loop(Looper.java:135)
[17:04:16]: ▸ at android.app.ActivityThread.main(ActivityThread.java:5254)
[17:04:16]: ▸ at java.lang.reflect.Method.invoke(Native Method)
[17:04:16]: ▸ at java.lang.reflect.Method.invoke(Method.java:372)
[17:04:16]: ▸ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[17:04:16]: ▸ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[17:04:26]: ▸ .
[17:04:26]: ▸ Time: 39.824
[17:04:26]: ▸ There was 1 failure:
[17:04:26]: ▸ 1) shouldTakeScreenshotInputDestination(com.xxx.xxx.Test)
[17:04:26]: ▸ java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
[17:04:26]: ▸ at tools.fastlane.screengrab.Screengrab$1.perform(Screengrab.java:77)
[17:04:26]: ▸ at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:144)
[17:04:26]: ▸ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
[17:04:26]: ▸ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
[17:04:26]: ▸ at android.os.Handler.handleCallback(Handler.java:739)
[17:04:26]: ▸ at android.os.Handler.dispatchMessage(Handler.java:95)
[17:04:26]: ▸ at android.os.Looper.loop(Looper.java:135)
[17:04:26]: ▸ at android.app.ActivityThread.main(ActivityThread.java:5254)
[17:04:26]: ▸ at java.lang.reflect.Method.invoke(Native Method)
[17:04:26]: ▸ at java.lang.reflect.Method.invoke(Method.java:372)
[17:04:26]: ▸ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[17:04:26]: ▸ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[17:04:26]: ▸ FAILURES!!!
[17:04:26]: ▸ Tests run: 4,  Failures: 1
@mfurtak
Copy link
Contributor

mfurtak commented Feb 26, 2016

Hi @digobaptista - Thanks for the report 👍

We actually just did a screengrab release 📷✨ yesterday which might have a fix for your problem. If you aren't already on v0.2.1 of the gem and the Android library, can you update those and let me know what you see?

@mfurtak mfurtak self-assigned this Feb 26, 2016
@digobaptista
Copy link
Author

@mfurtak This issue was reproduced with screengrab version 0.2.1 . Any idea why this is happening?

@mfurtak
Copy link
Contributor

mfurtak commented Feb 29, 2016

@digobaptista Hm, can you post a new stack trace from Android? Is it the same as before?

In addition to updating the gem, did you also update the dependency in your build.gradle?

androidTestCompile 'tools.fastlane:screengrab:0.2.1'

@digobaptista
Copy link
Author

@mfurtak After updating the dependency in my build.gradle the error is gone, but whenever I do a screengrab from a Material Dialog, it generates a png containing the view behind the Material Dialog.

@mfurtak
Copy link
Contributor

mfurtak commented Feb 29, 2016

OK, I suspect that this is a limitation of how we capture screenshots right now. #72 and #75 are other manifestations of this problem. Please keep an eye on those tickets for news about when we improve our capture method. 👍

@digobaptista
Copy link
Author

@mfurtak Thank you for the quick feedback, I'll keep an eye on those issues also.

@fastlanebot
Copy link

This issue was migrated to fastlane/fastlane#2078. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo 🚀

@fastlane-old fastlane-old locked and limited conversation to collaborators Mar 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants