text
stringlengths 1
474
|
|---|
icons guidelines for icon design.In the [project]/android/app/src/main/res/ directory,
|
place your icon files in folders named using
|
configuration qualifiers.
|
The default mipmap- folders demonstrate the correct
|
naming convention.In AndroidManifest.xml, update the
|
application tag’s android:icon
|
attribute to reference icons from the previous
|
step (for example,
|
<application android:icon="@mipmap/ic_launcher" ...).To verify that the icon has been replaced,
|
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 NoteThe 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,
|
run flutter run --debug and select an Android device:When prompted, enter y.
|
The Flutter tool enables multidex support and retries the build:info Note
|
Multidex support is natively included when targeting
|
Android SDK 21 or later. However, we don’t recommend
|
targeting API 21+ purely to resolve the multidex issue
|
as this might inadvertently exclude users running older devices.You might also choose to manually support multidex by following Android’s guides
|
and modifying your project’s Android directory configuration.
|
A multidex keep file must be specified to include:Also, include any other classes used in app startup.
|
For more detailed guidance on adding multidex support manually,
|
check out the official Android documentation.<topic_end>
|
<topic_start>
|
Reviewing the app manifest
|
Review the default App Manifest file, AndroidManifest.xml.
|
This file is located in [project]/android/app/src/main.
|
Verify the following values:<topic_end>
|
<topic_start>
|
Reviewing the Gradle build configuration
|
Review the default Gradle build file
|
(build.gradle, located in [project]/android/app),
|
to verify that the values are correct.<topic_end>
|
<topic_start>Under the defaultConfig block
|
<topic_end>
|
<topic_start>Under the android block
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.