text
stringlengths
1
372
run your app and inspect the app icon in the launcher.
<topic_end>
<topic_start>
enabling material components
if your app uses platform views, you might want to enable
material components by following the steps described in the
getting started guide for android.
for example:
to find out the latest version, visit google maven.
<topic_end>
<topic_start>
sign the app
to publish on the play store, you need to
sign your app with a digital certificate.
android uses two signing keys: upload and app signing.
to create your app signing key, use play app signing
as described in the official play store documentation.
to sign your app, use the following instructions.
<topic_end>
<topic_start>
create an upload keystore
if you have an existing keystore, skip to the next step.
if not, create one using one of the following methods:
run the following command at the command line:
on macOS or linux, use the following command:
on windows, use the following command in PowerShell:
this command stores the upload-keystore.jks file in your home
directory. if you want to store it elsewhere, change
the argument you pass to the -keystore parameter.
however, keep the keystore file private;
don’t check it into public source control!
info note
the keytool command might not be in your path—it’s
part of java, which is installed as part of
android studio. for the concrete path,
run flutter doctor -v and locate the path printed after
‘java binary at:’. then use that fully qualified path
replacing java (at the end) with keytool.
if your path includes space-separated names,
such as program files, use platform-appropriate
notation for the names. for example, on Mac/Linux
use program\ files, and on windows use
"program files".
the -storetype JKS tag is only required for java 9
or newer. as of the java 9 release,
the keystore type defaults to PKS12.
<topic_end>
<topic_start>
reference the keystore from the app
create a file named [project]/android/key.properties
that contains a reference to your keystore.
don’t include the angle brackets (< >).
they indicate that the text serves as a placeholder for your values.
the storeFile might be located at
/users/<user name>/upload-keystore.jks on macOS
or C:\\Users\\<user name>\\upload-keystore.jks on windows.
warning warning
keep the key.properties file private;
don’t check it into public source control.
<topic_end>
<topic_start>
configure signing in gradle
configure gradle to use your upload key when building your app in release mode
by editing the [project]/android/app/build.gradle file.
add the keystore information from your properties file before the android block:
load the key.properties file into the keystoreProperties object.
find the buildTypes block:
and replace it with the following signing configuration info:
release builds of your app will now be signed automatically.
info note
you might need to run flutter clean after changing the gradle file.
this prevents cached builds from affecting the signing process.
for more information on signing your app, check out
sign your app on developer.android.com.
<topic_end>
<topic_start>
shrinking your code with r8
r8 is the new code shrinker from google, and it’s enabled by default
when you build a release APK or AAB. to disable r8, pass the --no-shrink
flag to flutter build apk or flutter build appbundle.
info note
obfuscation and minification can considerably extend compile time
of the android application.
<topic_end>
<topic_start>
enabling multidex support
when writing large apps or making use of large plugins,
you might encounter android’s dex limit of 64k methods
when targeting a minimum API of 20 or below.
this might also be encountered when running debug versions of your app
using flutter run that does not have shrinking enabled.
flutter tool supports easily enabling multidex. the simplest way is to
opt into multidex support when prompted. the tool detects multidex build errors
and asks before making changes to your android project.
opting in allows flutter to automatically depend on
androidx.multidex:multidex and use a generated
FlutterMultiDexApplication as the project’s application.
when you try to build and run your app with the run and debug
options in your IDE, your build might fail with the following message:
to enable multidex from the command line,