Flutter-Publish to the App Stores

In this topic, we will learn how we can publish flutter applications to the play store and app stores.

Publishing flutter application to the Play Store and App Store.

There are some steps involved in publishing the flutter application to the play store. Let’s see what those steps are:

  1. Test and enhance our code.
  2. Set the name of the application and identifier.
  3. Prepare third-party services like API keys for production.
  4. We are adding an application icon.
  5. Publish to the play store.

STEP 1: The first step involved testing and enhancing our flutter code. In order to do that, we can test our flutter application on as many real devices and simulator/emulator as we can. This will help us to judge whether the application is working fine or not, and enough bugs are solved or not.

Enhancing the code is yet another very helpful solution. We can create more const objects and widgets so that during the building stage, the code knows that this part is constant and does not need to be rebuilt.

STEP 2:  For the next step, we will first go to Android> app > src > AndroidManifest in our flutter application. There we will see

Android:label = “THE NAME OF THE APPLICATION.”

This code line is very important as it contains your application’s name that will be seen by the users. So, make sure we choose a nice and catchy name.

TIP: Also, make sure we have all the permissions needed in our AndroidManifest file.

We can also change the identifier for Android and iOS separately.

Now for the iOS part of the flutter application, we will head over to iOS > Runner > Info.plist, and from there, we will ensure whether all the permissions are given or not.

STEP 3: Let us now make sure that whether our third-party APIs and other services are configured or not. If we are using firebase, we will make certain security rules are correctly implemented. In the case of Google APIs, we will go to Google Cloud Platform to see which APIs are we using.

STEP 4: In this step, we will give an icon to our application. For that, we will visit pub.dev and search for flutter_launcher_icons. We will then install it for configuration by going to the “pubspec.yaml” file and adding it to the dev_dependency. The packages in dev_dependency are those that are only used during development time when we create these icons. It will not be a part of our final application bundle. 

Next, we will configure package in “pubspec.yaml” file again. For that, we will copy this code with few modifications to our “pubspec.yaml” file.

Now the last step is to run the following command:

Publishing flutter application on Play Store (Android):

We will understand in detail how we can publish our flutter application on the play store.

STEP 1: The first step is to create a Keystore. For that, we will run this command on MacOS or Linux:

And this command on Windows:

STEP 2: In this step, we will create a new file by the name key.properties under Android that will reference the Keystore and the following code in that file.

STEP 3: We will now go to android > app > build.gradle file and configure signing in. Copy the following code and replace it with android { code. Remember, only this code needs to be replaced nothing more or less.

Also, add the code given below to the buildTypes block:

And the signing configuration info:

STEP 4: We will now shrink code with the help of R8; it is a code shrinker by Google, which is by default, enabled when we build an APK or AAB.

STEP 5: The most crucial step in this process is building the APK and app bundle. We will discuss each one separately in detail.

App Bundle

We will run the following commands from the command line:

Replace <app dir> with the name of the application’s directory.

The bundle for our application will be made at <app dir>/build/app/outputs/bundle/release/app.aab.

APK

We will run the following command from the command line:

Replace <app dir> with the name of the application’s directory.

Three bundles will be created at:

  • <app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
  • <app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk
  • <app dir>/build/app/outputs/apk/release/app-x86_64-release.apk

For installing APK, connect the android application. Change directory cd<app dir>. And run flutter install.

The last step is to publish our flutter application in the Google Play Store.

Publishing flutter application on App Store (IOS):

Preliminaries:

  • Make sure it meets Apple’s App Review Guidelines.
  • Enroll in the Apple Developer Program

STEP 1: The first step is to go to the App Store Connect (click on this link- https://appstoreconnect.apple.com/) and log in using Apple ID and password; once it verifies our account, we will be signed in there. Next, we will simply click the App ID’s link, and there we will see identifiers. Click on that and register a new app ID. Select the services and platform, which will be iOS. Authenticate and verify the details and click register for registering Bundle ID.

STEP 2: In this step, we will go back to App Store Connect, and from there, we will head over to My apps and click on “+” on the screen and fill in the necessary details about our application.

STEP 3: The next step is to review Xcode settings. In Xcode, we will open Runner.xcworkspace, which is located in our application’s ios folder. Now select the Runner project and in the main view sidebar, select runner target. Then, choose the general tab and confirm the settings given below:

  • Display Name
  • Bundle Identifier
  • Automatically manage to sign
  • Team
  • Deployment target

STEP 4: We will now update our application’s version number. That we will do by going to pubspec.YAML file and adding this line:

STEP 5: After all this is done, we will restart Xcode and go to Product > Scheme > Runner and Product > Destination > Generic iOS Device. Also, we will go to Product > Archive. This step will create a bundle in our iOS application into an app bundle that can be deployed.

STEP 6: The last step in this process is to release our application to the app store. For that, we will:

  1. Choose pricing, availability and complete other required information.
  2. Now choose the status from the sidebar. If we are uploading a new application, the status will be 1.0. We will now complete other required information.
  3. The last step is to click on Submit for Review.

We will be notified when our application is completely reviewed and verified, and our application will be released with all the necessary details/information we stated above.

Pin It on Pinterest

Share This