Flutter, how to compile the project to run native on android

Asked

Viewed 4,738 times

0

I’m starting in Flutter, I would like to know how to compile my project to be a native application, such as for Android. How can I do this from the command line? I found Andoid studio very confusing.

Thanks for the personal help!

  • Some people use vs code with the Dart and flutter plugin instead of android studio.

  • For it to run on android if I’m not mistaken or is flutter run or flutter run android

  • @Julianamarques flutter run runs in debug mode. My answer clarifies.

2 answers

1


The SDK Flutter alone has its build modes, in which we could do something different depending on the mode in which our app is running, are they:

  • Debug: It’s the only mode we can run on emulators, known as the debug banner displayed when running the app. The assertions in the Code are enabled, as well as the Observatory. It has a larger final package size generated, since it is optimized only for development. To run just the command flutter run.
  • Profile: Still maintains some debug features, can only be run in physical Vices, to keep the actual performance. To run just flutter run --profile.
  • Release: Also runs only on physical Vices, is the mode in which we use to generate the final package for stores as it is optimized for execution and final size of the binaries, generated through the flutter run --release or flutter build.

So, to compile a final version, which manages APK by compiling AOT on your device, simply flutter run --release or flutter build.

Source in portuguese and english.

1

Just run on the command line flutter run --release

As for Android Studio, a good alternative that people have adopted for a long time is to use Microsoft’s Visual Studio Code. Simple to use, lightweight and customizable with large repository of available extensions.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.