Flutter Platform is a trending solution for startups with cost effective investment. Because, it lets you develop an Application for multiple platforms like Android, iOS, MacOS, Linux or Web with an expense of single business logic. So, in this tutorial we will build and Submit Flutter App on Google Play Store for review.
Review AndroidManifest.xml
Firstly, it involves to review App manifest file or AndroidManifest.xml file which is located in the android > app > src > main folder of the flutter app. Let’s review the following:
Review App Title or Label
Edit the android:label to change the default title of the application:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="My Cool App"
android:icon="@mipmap/ic_launcher">
Add User Permissions (if any)
Add various permissions that an application require from the user. Such as internet, notifications or vibration etc.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.thecreatology.mycoolapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name="io.flutter.app.FlutterApplication"
android:label="My Cool App"
android:icon="@mipmap/ic_launcher">
Launcher Icons & Splash Page
Generate Launcher Icons Natively
Using the flutter_launcher_icons package lets you update the Flutter app’s launcher icon natively. By natively, it means that working within the scope of flutter set the launcher icons for Android as well as iOS.
- Open pubspec.yaml and add flutter_launcher_icons as a dev_dependency:
dev_dependencies:
flutter_launcher_icons:
flutter_icons:
image_path: "assets/images/app_icon.png"
android: true
ios: false
- Also make sure to add app_icon.png in the assests/images directory in the root of Flutter App.
- Then do a Pub Get or type flutter pub get in the terminal window from Flutter App root directory.
- Finally type flutter packages pub run flutter_launcher_icons:main to generate icons as per the configuration defined in pubspec.yaml file.
Generate Splash Screen Natively
Similarly, flutter’s default splash screen is a simple white screen, which is not impressive at all. Therefore and based on the same theory as the above launcher icons, you can generate a splash screen for your flutter app natively. Using the flutter_native_splash package lets you update the Flutter app’s splash screen natively.
Open pubspec.yaml and add flutter_launcher_icons as a dev_dependency:
dev_dependencies:
flutter_native_splash:
flutter_native_splash:
image: assets/images/splash.png
color: "#cccccc"
- Also make sure to add splash.png in the assests/images directory in the root of Flutter App.
- Then do a Pub Get or type flutter pub get in the terminal window from Flutter App root directory.
- Type flutter pub pub run flutter_native_splash:create to generate and set splash screen for both Android and iOS as per the configuration defined in pubspec.yaml file.
Go to the next page to submit flutter app on Google Play
Publish Flutter App on Android Store
So, to publish any Android App or Flutter App to Google Play, requires a digital signature. Let’s sign our App using the keytool to build a keystore.
Step 1: Generate KeyStore using KeyTool
On Mac:
keytool -genkey -v -keystore ~/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
On Windows, use the following command:
keytool -genkey -v -keystore c:/Users/REPLACE_USER_NAME/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
As a result, it will prompt to confirm the information for Name, Organisation Name, Password, City, State & Country Code. Upon confirming with Y or Yes to generate the Keystore for your Flutter App. Make note of the password submitted above as we will use it in next step.
Step 2: Reference KeyStore in the App
Create a new file named /android/key.properties inside the flutter app root directory, that contains a reference of the above keystore. Add the following content in the file:
storePassword=REPLACE_STORE_PASSWORD
keyPassword=REPLACE_KEY_PASSWORD
keyAlias=key
storeFile=c:/Users/REPLACE_USER_NAME/key.jks
Give the password, alias & keystore path which you had given earlier to generate the keystore.
Step 3: Configure signing in Gradle
Open application level build.gradle file from /android/app/build.gradle and add the following code before android {….} block:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
...
}
And the following code before buildTypes:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Step 4: Versioning & Build App bundle
Review the version in the App in pubspec.yaml file:
version: 1.0.0+1
After saving the version build your app’s APK to finally publish it on Google Play Store. In the terminal window type the following commands:
cd <flutter app root directory path>
flutter build apk
The App release bundle is saved at /build/app/outputs/apk/release/app.apk and we are partially ready to submit flutter app on Google Play.
Step 5: Submit Flutter App on Google Play for Review
Final step is to submit the Flutter App on Google Play. Following the below steps:
- Sign up for or Sign in into the Google Play Console.
- Create a new application and give it a relevant name.
- On the Store Listing page fill up all the mandatory details such as upload icons, screenshots, assign categories and other content ratings.
- On the App releases page, add the flutter app APK release bundle to the production track and give a release name.
- Also make sure to complete all the mandatory fields and sections before you submit your app for review.
- Press the Submit for Review button and wait for Google Play team to revert back with a store listing page.
That’s pretty much it. In case you have any questions to ask, do leave a comment below.