1

I faced the task of reducing the size of .apk file of my android app. My apk size is more then 100MB now and tentatively it will grow. So I consider android app bundle as a temporary solution. .so libraries take the most space in apk and I'd like to take them off to expansion files if it is possible. Does anybody have such experience, and what can you advice to learn to solve this problem?

Nikolai
  • 656
  • 6
  • 19
  • Out of curiosity, why do you consider the App Bundle a temporary solution? With Dynamic Delivery, you can split your app into separate "dynamic feature modules" that can be served on demand, so unless your users will always be offline, consider keeping your app size in check with this. – Pierre Dec 09 '19 at 10:02
  • I think so because AAB file size limit is 150MB, and I predict that this limit can be reached by my app in several version release. – Nikolai Dec 10 '19 at 08:38
  • The limit is on the maximum *initial download size*, not on the whole AAB. So if you include native libraries for multiple ABIs for example, only the bigger one will be counted towards the 150 MB. Also, as you add on-demand dynamic features, these won't be counted towards the 150 MB either. You can use bundletool to calculate an estimate of the download size (see the "get-size" command) – Pierre Dec 10 '19 at 15:54
  • @Pierre i guess that is because creating an app bundle is trivial, just select to deploy as bundle instead of APK. Implementing dynamic features will require change of code and possible user interface where the user will need to wait till feature is downloaded. – htafoya Sep 10 '20 at 00:23
  • Implementing expansion files also requires a lot of changes to the code. It also requires to constantly check that the user hasn't deleted local storage with the expansion files, and if they have, manually trigger the re-download of the files. I don't know of many developers who have enjoyed using expansion files. – Pierre Sep 10 '20 at 10:21

1 Answers1

1

Reduce the size of your app by moving '.so' files to over-the-air. Follow this link

But this violates the Google Policy

You should:

  • Remove unused resources(image, layout, lib/dependency)

  • Turn on shirk resource on build.gradle

  • Moving something to OTA

  • Build the App bundle instead of APK

Brian Hoang
  • 1,111
  • 9
  • 18
  • I do not understand why this violates Google Policy. There is written _"Apps or SDKs that download executable code, such as dex files or native code, from a source other than Google Play."_ But apk expansion files technology is not _"source other than Google Play"_, isn't it? – Nikolai Dec 10 '19 at 08:33
  • Follow the link I have mentioned, the .so file not on Google Play, it on your server. If you can upload .so file Google Play, it will be fine. – Brian Hoang Dec 10 '19 at 19:13
  • It may be against policy because expansion files are downloaded into a public folder. So malicious code may potentially edit the bytecode to alter the execution of your code. – htafoya Sep 10 '20 at 00:26