mmcc007 / screenshots

Screenshots: A command line utility and package for capturing screenshots for Flutter
Other
264 stars 144 forks source link

Unsupported Device size for Android devices in combination with Fastlane #212

Open patreu22 opened 4 years ago

patreu22 commented 4 years ago

Hello there,

I have a workflow set up to generate my iOS screenshots for the AppStore. I use screenshots to take the shots from my Flutter app and then, as intended by the creator of this package, I switch over to Fastlane and use frameit to use the frames, put them on a background and at titles to the screenshots as it is the current status quo how people do it on AppStores. Since Fastlane added Android support for frameit I tried to do the same for the Android version of my apps. That doesn't work out, because the screenshots this tool generates (without frames) are too small and I get an unsupported device size error from Fastlane. Framing the snaps with screenshots brings them into the right size, but frameit doesn't support it to use screenshots that are already rendered into devices. Does anybody have a workaround or solution for that? Would save a ton of work for many people to find a workaround I guess!

MiguelSOliveira commented 3 years ago

Did you end up finding a solution @patreu22?

I'm also having this problem. I know this is an old issue but I'll leave my solution here anyways, in case it helps someone else.

In my case the problem was the screenshot was taken without the navigation bar, so instead of having 2280 pixels in height, it had 2148 which is the height it should have minus the navigation bar's height.

The solution I've found so far is not ideal but it's working for me at the moment:

And with this I can use this package to create an unframed screenshot that is then framed and decorated by frameit.

Hope it helps.

patreu22 commented 3 years ago

Thanks a lot for taking the time to share your approach! Actually I didn't dive deeper into the issue because I got distracted, but I will use your approach to make it work again. Anyhow, this repo really needs more maintenance, working with Fastlane is a MUST, not a nice-to-have.

patreu22 commented 3 years ago

@MiguelSOliveira May I ask which devices you use? Cause I'm using the Nexus 6P and the size with [1440, 2392] is still unsupported. It works with the Nexus 9P though!

MiguelSOliveira commented 3 years ago

I'm currently using Pixel 4 emulator and a OP6 physical device @patreu22.

I remove the navbar on the Pixel 4 emulator so the screenshot ends up as 1080x2280, but with the OP6 physical device I don't need to do any tweaks, since it does not have a navbar.

marcschw commented 3 years ago

I'll add my workaround - maybe it helps some people.

First thing you need to know is that fastlane frameit currently only supports 3 devices for android - the Samsung S8, S9 and the Pixel XL 3. It checks exactly for the screenshot sizes of these three devices when you run the android specific command "fastlane frameit android" (see https://github.com/milhauscz/fastlane/blob/2a7e5c827342d0458774b3a1ef7b148c43c31705/frameit/spec/device_spec.rb for the code where you'll see there are currently just those three device sizes although the facebook repo used https://github.com/fastlane/frameit-frames/tree/gh-pages/latest would support a lot more recent Android devices - then again they kinda all look the same anyway...)

As described above unfortunately screenshots is taking screenshots which are too big for fastlane to recognize when it comes to those Android devices, that is why I created some custom virtual devices accounting for the additional screensize: I created modified custom hardware profiles: "Samsung Galaxy S9m" with screen size 1440 x 3152 (5.8") "Pixel 3 XLm" with screensize 1440 x 3104 (6.3")

If you wanted to use the S8 all you'd have to do is measure the difference in pixels and add it to your custom device.

They will both be put in the phone folder but I'll try to use the Pixel Screenshots as 7" Tablet, let's see if it passes.

Another interesting alternative is Herbert Poul's "frameit_chrome" solution which gives you access to any frame you want since you download them locally and also allows any formatting via CSS: https://github.com/authpass/frameit-chrome https://codeux.design/articles/automatically-add-device-frames-and-text-to-app-screenshots/

I hope that helps! Surely cost me a few days figuring this out.