text
stringlengths
1
372
runs without further recommendations.
when successful, this command outputs an app-release.aab
file in build/app/outputs/bundle/release.
a successful build does not always mean the app was
built as intended. it is up to you to ensure that all loading
units and dart libraries are included in the way you intended.
for example, a common mistake is accidentally importing a
dart library without the deferred keyword,
resulting in a deferred library being compiled as part of
the base loading unit. in this case, the dart lib would
load properly because it is always present in the base,
and the lib would not be split off. this can be checked
by examining the deferred_components_loading_units.yaml
file to verify that the generated loading units are described
as intended.
when adjusting the deferred components configurations,
or making dart changes that add, modify, or remove loading units,
you should expect the validator to fail.
follow steps 3.1 through 3.6 (this step) to apply any
recommended changes to continue the build.
<topic_end>
<topic_start>
running the app locally
once your app has successfully built an .aab file,
use android’s bundletool to perform
local testing with the --local-testing flag.
to run the .aab file on a test device,
download the bundletool jar executable from
github.com/google/bundletool/releases and run:
where <your_app_project_dir> is the path to your app’s
project directory and <your_temp_dir> is any temporary
directory used to store the outputs of bundletool.
this unpacks your .aab file into an .apks file and
installs it on the device. all available android dynamic
features are loaded onto the device locally and
installation of deferred components is emulated.
before running build-apks again,
remove the existing app .apks file:
changes to the dart codebase require either incrementing
the android build ID or uninstalling and reinstalling
the app, as android won’t update the feature modules
unless it detects a new version number.
<topic_end>
<topic_start>
releasing to the google play store
the built .aab file can be uploaded directly to
the play store as normal. when loadLibrary() is called,
the needed android module containing the dart AOT lib and
assets is downloaded by the flutter engine using the
play store’s delivery feature.
<topic_end>
<topic_start>
improving rendering performance
info note
to learn how to use the performance view
(part of flutter DevTools)
for debugging performance issues,
see using the performance view.
rendering animations in your app is one of the most cited
topics of interest when it comes to measuring performance.
thanks in part to flutter’s skia engine and its ability
to quickly create and dispose of widgets,
flutter applications are performant by default,
so you only need to avoid common pitfalls to achieve
excellent performance.
<topic_end>
<topic_start>
general advice
if you see janky (non-smooth) animations, make
sure that you are profiling performance with an
app built in profile mode.
the default flutter build creates an app in debug mode,
which is not indicative of release performance.
for information,
see flutter’s build modes.
a couple common pitfalls:
for more information on evaluating performance
including information on common pitfalls,
see the following docs:
<topic_end>
<topic_start>
mobile-only advice
do you see noticeable jank on your mobile app, but only on
the first run of an animation? if so, see
reduce shader animation jank on mobile.
<topic_end>
<topic_start>
web-only advice
the following series of articles cover what the flutter material
team learned when improving performance of the flutter gallery
app on the web:
<topic_end>
<topic_start>
flutter performance profiling
info note
to learn how to use the performance view
(part of flutter DevTools)
for debugging performance issues,
see using the performance view.
<topic_end>