Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build app compliant with Google Play 64-bit requirement?

After I upload the APK to play store I got the following warning. What changes should I make to release an APK build with flutter SDK to meet the 64-bit requirement?

The warning message: enter image description here

like image 966
Xihuny Avatar asked May 04 '19 13:05

Xihuny


People also ask

Can 32-bit Android app run on 64-bit?

For the unaware, Android currently supports both 32-bit and 64-bit applications. Due to this, developers have to maintain two binaries for their apps and ARM has to offer CPUs that feature legacy 32-bit support.

How can I tell if an APK is 64-bit?

The simplest way to check for 64-bit libraries is to inspect the structure of your APK file. When built, the APK will be packaged with any native libraries needed by the app. Native libraries are stored in various folders based on the ABI.

Are Android apps 64-bit?

That's despite the fact that the Armv8 ISA introduced the AArch64 execution mode back in 2011, Android 5.0 Lollipop introduced platform-level support for 64-bit apps in 2014, and Google Play mandated that apps support 64-bit CPUs in 2019.


Video Answer


2 Answers

Edit/Update: Google has released Flutter 1.7.8+hotfix.3 in stable channel, which makes easy to build an app for release.

Now you have two options to build :

  1. App bundle (preferred)
  2. APK

Generating App Bundle

Run flutter build appbundle

This will create <app dir>/build/app/outputs/bundle/release/app.aab

T app bundle contains your Dart code and the Flutter runtime compiled for armeabi-v7a (32-bit) and arm64-v8a (64-bit).

Now you can upload this app bundle to google play.

Build an APK

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 

Removing the --split-per-abi flag results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that are not applicable to their device’s architecture.

If you haven't upgraded to flutter 1.7 Below solution should still work.

You need to build two apk and upload them together. one for 32 and another for 64 bit.

This is what worked for me I am on flutter v1.5.4-hotfix.2

First, run flutter build apk --release and upload the apk file

Then increase the version and build number in pubspec.yml file and run

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

Upload this new apk and start rollout.

Good luck

like image 130
CodeforCore Avatar answered Sep 20 '22 22:09

CodeforCore


Guys they changed new policies for 64-bit architectures. So please put this code in your gradle

ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' 

for e.g.

android {     compileSdkVersion 28     defaultConfig {         applicationId "com.test.test"         minSdkVersion 15         targetSdkVersion 28         versionCode 1         versionName "1.0"         ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     } } 
like image 29
Dharmbir Singh Avatar answered Sep 21 '22 22:09

Dharmbir Singh