skip to Main Content

I have flutter’s app. I run it app in debug mode on iPhone from Android Studio(on Mac). It is very slowly(about 10 minutes). if I run my project from xCode it is much faster – about a minute.

enter image description here

this is a "medium" project, it uses some firebase packages:

 firebase_messaging: ^10.0.3
 firebase_analytics: ^8.1.2
 firebase_remote_config: ^0.10.0+2
 firebase_core: ^1.3.0

but I did not find any problems on the net related to these plugins, only for cloud_firestore.
how can I determine what is the problem with the long build? any advice?

2

Answers


  1. Chosen as BEST ANSWER

    I solved this problem - new Mac Mini(M1/8 Gb). the first build can last 40-50 seconds (10 times faster). next build - of 10-25 seconds.


  2. There are several ways to speed up the build process for an iOS app in Flutter:

    Use the profile build mode: By default, Flutter builds in the debug mode, which includes additional features for debugging and development. However, building in the profile mode can significantly speed up the build process. You can switch to the profile build mode by running the command flutter build ios --profile.

    Enable AOT compilation: Ahead-of-Time (AOT) compilation can improve the performance of your app by compiling the Dart code to machine code before it’s run. You can enable AOT compilation by running the command flutter build ios --release --no-codesign.

    Use flutter build command instead of flutter run: The flutter run command is convenient for development, but it’s slower than the flutter build command because it includes additional features like hot reloading and debugging.

    Use flutter build bundle command: flutter build bundle command generates an asset bundle for your app, including all the resources like images, fonts, and JSON files. This command is faster than flutter build command because it only build the necessary asset, not the entire app.

    Reduce the size of your app: Remove unnecessary assets, libraries and classes that are not used in your app. You can use flutter analyze command to detect any unnecessary parts in your code.

    Clean and rebuild: Sometimes the build process can be slow due to stale files or cached data. Running the flutter clean command and then rebuilding can help speed up the process.

    Use a Mac with more powerful hardware: Building for iOS requires a Mac, and building time can be affected by the performance of the Mac you are using. If you are using a Mac with lower performance, you can try building on a more powerful Mac or using a cloud-based Mac build service like Bitrise or CircleCI

    It’s also good practice to keep your Flutter SDK and Xcode updated to the latest version to take advantage of performance improvements.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search