Flutter

How to solve release is not compliant with the Google Play 64-bit requirement in flutter

flutter

This is my first post after exploring the Google Flutter framework for developing the cross platform apps in this framework. I am fascinated by the ease and simplicity of creating the UI in Dart programming. I will share my experience and the error and workaround that I went through while releasing a small size apk on play store.

This release is not compliant with the Google Play 64-bit requirement in flutter.

Error was:Flutter release apk error.

All is well that ends well.

This proverb means lot to me as a developer because we have to showcase the world what we have developed in the app from play store and this doesn’t happen to me and I wasted a whole day dealing with this.

After following the steps described here in https://flutter.dev/docs/deployment/android

You have two possible release formats when publishing to the Play Store.

  • App bundle (preferred)
  • APK

Note: The Google Play Store prefers the app bundle format. For more information, see Android App Bundle and About Android App Bundles.

I ignored the note as I always do as a native Android app developer I always release .apk on play store console. So I will describe the steps that leads to the problem and then quickly I will reveal the solution to this issue.

Steps:

Whenever we build a release apk with this command:

flutter build apk –release 

Now there is nothing wrong in this command but this command generates a Fat apk which contains the resources. let say approx for example 16 MB (for my app)

Contents

What is a fat APK?

fat APK is a single APK that contains binaries for multiple ABIs embedded within it. This has the benefit that the single APK runs on multiple architectures and thus has wider compatibility, but it has the drawback that its file size is much larger, causing users to download and store more bytes when installing your application.

When building your application in release mode, Flutter apps can be compiled for armeabi-v7a (32-bit) and arm64-v8a (64-bit). Flutter does not currently support building for x86 Android

Another option is to generate apk per ABIs using this command:

flutter build apk –split-per-abi

This command results in two APK files:

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

Now going by this approach in my case these two apks were of 6 MB approx(for my app).

Wow. How this happened !!

There is no magic behind this if you have used Realm.io then also you have faced similar issue of app size increased significantly, and we are left with no other option to release multiple apks on play store for each architecture(ABIs). ==============We will talk later about this in same post.

Now the situation here is how you can upload these two apks for each release. In earlier days we have the advanced mode in Google developer console

But now you will  not find this in your account.

Problem: Upload two apks for same version (1.0.0) for two different architecture.

Most of the solutions related to these questions on stackoverflow are related to switching to advanced mode and upload multiple apks but guess what this is no longer available.

https://stackoverflow.com/questions/42049253/publish-multiple-apks-to-google-play-store

MANUAL APPROACH:(NOT RECOMMENDED)

Solution for now is this: Go to

Android->app->build.gradle

Step 1:

Step 2:

run flutter build apk --release --target-platform=android-arm

Step3:

upload app-armeabi-v7a-release.apk to the play store

Step 4:

increment versionCode

I am using VS code and from there I have incremented the version code like this:

version:1.0.0+1( for first apk)  and change/increment version:1.0.0+2 (for second apk).

Step 5:

run flutter build apk --release --target-platform=android-arm64

Step 6:

upload app-arm64-v8a-release.apk to the play store.

Now in playstore console you can select artifacts library and you can see two apks with version code 1 and version code 2.

Now go ahead and release both the apks . Play store will automatically serve the apk files based on the users android phone architecture.

RECOMMENDED WAY.

You remember about the note that Flutter recommended

We just have to release .aab (Android App bundle) its not a new things and guess what our life will be too easy with this bundle. Because play store automatically generates the apk files from this .aab file. How playstore does that ?

BUNDLETOOL

 

Before release, you can install the bundle tools and can generate the apks from bundle tool command line options by following steps from here

Now you just deploy one single .aab file . No need to follow manual method of uploading a separate apk after incrementing version code and all those long process. I would recommend going with .aab file.

Check this link:

Top 10 free Android libraries for app development in android studio

 

Please suggest or comment if you have better thing to share or improve this post.

Feeling glad to receive your comment