shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
2.31k stars 140 forks source link

fix: shorebird release android takes more time then flutter build release #2508

Open ahmed-moha opened 4 weeks ago

ahmed-moha commented 4 weeks ago

App ID: (bf471287-284e-478b-8de1-6c11a09110fc)

Description There is an issue where the Shorebird release process for Android builds takes considerably longer than the standard flutter build release command.

eseidel commented 4 weeks ago

Hmm, that's definitely unexpected. iOS does take longer than normal. But Android should not.

Can you share the commands you're comparing?

shorebird release does have to download the necessary version of Flutter the first time it's run which might be the difference?

ahmed-moha commented 3 weeks ago

Hmm, that's definitely unexpected. iOS does take longer than normal. But Android should not.

Can you share the commands you're comparing?

shorebird release does have to download the necessary version of Flutter the first time it's run which might be the difference?

When I run flutter build apk --release, it takes about 65 seconds to complete the build on Android. However, when I use shorebird release, it takes approximately 300 seconds. This is significantly longer than the standard Flutter build time.

I noticed that the first time I ran shorebird release, it downloaded the necessary version of Flutter, which I understand might cause some initial delay. However, even on subsequent builds, the build time remains much longer than expected.

Is there something that might be causing the longer build times with Shorebird on Android? Are there any optimizations or configurations I can apply to reduce the build time?

Thanks for your help!

eseidel commented 3 weeks ago

Hmm, that's definitely not expected. We don't currently have an easy way to print timing information for shorebird release, but maybe need to add something there.

% flutter create build_test
% cd build_test
% shorebird init
% shorebird doctor
% time flutter build aab
flutter build aab  1.46s user 0.30s system 5% cpu 30.786 total
% time shorebird release android 
shorebird release android  9.99s user 2.87s system 28% cpu 45.769 total

shorebird release will download flutter, etc, if it needs to (which can take a long time).

I'm surprised that Shorebird took 15s longer than flutter build aab, but it is doing a bunch of uploading data, etc.

cyajae commented 3 weeks ago

Same issue here after upgrading shorebird and flutter. Android build time is around ~100s in early versions.

Screenshot 2024-10-08 at 11 12 41 AM

Shulyakovskiy commented 3 weeks ago

Something happened after the update, the release build takes a huge amount of time. While I was writing the message, the build was not completed. What else can be checked? Gradle - gradle-8.4-all

image image image

Shulyakovskiy commented 3 weeks ago

1728373776271_shorebird.log Full logs

felangel commented 3 weeks ago

Looks like the upload to the storage bucket is what's taking the majority of the time

Shulyakovskiy commented 3 weeks ago

Discord topic https://discord.com/channels/1030243211995791380/1293125397394751581

cyajae commented 2 weeks ago

it is not make sense the long building time. Still building after ~1000sec. Wasted time and money.

image image

eseidel commented 2 weeks ago

Thank you for the report. I presume if you build with flutter build ipa --dart-define-from-file='.credentials/prod.json' with Flutter 3.24.3, it works? I would not expect it to take 20 minutes to build. We'd be happy to jump on a call and debug with you if that could help.