Minimum requirements to run an Android app - android

How to know the minimum device requirements to run my app in terms of memory and space. Is it through the minimum API which is 21 in my app or I need to monitor or calculate something. For space I build the APK with proguard true and it is 32,628kb while when I install it 50.79MB. Shall I say minimum space is 50.79MB?.
Any help is appreciated.

it will be fine when you set requirement that this app requires API 21,and the size of your apk is important not your debug apk size, the specify size should be your released apk size.

As far as I know there is no rocket science behind that. Check this thread: Why does my app size on device differ than the APK or Play store size
Quoting from #PFROLIM:
When installing an APK in android system, what's installed is the DEX
file. Which contains your code, resources etc compiled as binaries.
Your dex is generally the same size of your apk, unless you have
resources not compiled in assets.
Well, we all know that. What's not widelly spread is that android
SAVES your original apk too. Perhaps for reinstalling in case of
errors or for some other reasons.
That's why the amount of memory of our apps is the double in system.
It's the sum of the size of the original apk and the installed dex.

Related

Dealing with phone architectures and processor types on Android APK file

I've generated a release apk of my Android project in order to do some internal testing via the Developer Console.
Upon generating it, I clicked to analyze the APK file. From the picture I see most of my APk allocations go to libraries and assets.
I'm focusing on the architectures of ARM X86 and X64. I believe they are processor speeds on phones and
upon the APK being installed on a phone the Play Store will determine the phones processor and architectures and then download my APK based on that scenario.
My question is that with Android migrating to 64 bit architecture apps can't I get rid of the ARM architectures that aren't 64 bit based.
I'm unsure of what do do and would like to get rid of these extra architectures if possible to reduce APK size.
Please see the picture provided
Today, the vast majority of Android devices today are arm. The Device Catalog on the Play Console reports 98% of devices supported by Play are running on ARM. Although this number does not take into account devices not supported by Play or the number of users on each device, it still gives you an idea of the proportions.
That being said, regardless of the architectures you choose to support, when publishing to Play, you should always add support for 64 bits of that architecture. For example, if you want to support arm, you must have the libraries for arm64-v8a and if you want to support x86, you must have the libraries for x86_64.
However, to reduce APK size, there is now a better way: publishing an Android App Bundle. Play introduced this new publishing format to solve that exact problem: you publish a single App Bundle to Play, and Play takes care of generating the APKs optimized for each device, containing only the files needed for their device architecture, screen density and language (customizable).
All it takes is to enroll in Play App Signing in the Play Console (so that Play can sign the APKs it generates on your behalf), and select "Build Android App Bundle" in Studio instead of "Build APKs". -- If you use Gradle, gradlew bundleRelease instead of gradlew assembleRelease.
Hope that helps,

Android app bundle generated APK size huge when containing .so files

I have a project that includes a couple of cpu architecture specific .so files - the biggest being the xwalk lib, which is 60MB for the v8a version and 37MB for the v7a version.
When we had split APK the arm-v7a app apk version would be around 38mb and the arm-v8a apk would be around 41mb, which makes sense - zipping the lib would result in 23MB and 20MB, respectively.
When using app bundles it seems that the generated APKs are not compressed at all. the 60MB and 37MB are added to the apk size almost unchanged, resulting in a 97MB apk for 64bit arm devices.
I get consistent result when using the bundletool to generate the apks for one specific device and when downloading from the internal app testing play store site which returns the apks also depending on the device.
Am I missng something here or are app bundles not the best option when containing .so files and one is better off using split APKs again?
What matters is not the file size of the APK, but the download size of your app and the size on device of your app.
When you build an App Bundle, by default Play will leave the native libraries (.so) uncompressed in the generated APKs. Although this leads to a bigger APK file, this results in:
Smaller downloads for users because the compression over-the-wire can be more efficient,
Smaller app size on the device because the Android platform can mmap the .so files directly into memory without having to extract them first into a directory (thus saving a copy of the uncompressed .so file on disk).
bundletool actually provides a command get-size which estimates the download size for you. In practice, this the size is often even smaller when better compression algorithms can be applied, but this is a best effort by Play.
Here's a video from Google I/O 2019 where they explain the difference between the different types of size you can measure (at 15:55), and what Play does to help reduce the size of apps.
Hope that helps,

Flutter APK greater than 100 MB

My android release apk size built using Flutter is around 150MB. I would like to upload this apk to the google play store but play store has a apk size limit of 100MB. In Android app development we create APK expansion files for such limit in steps shown in this link. Would like to know the steps in Flutter code to create and use similar expansion files and reduce the app size to below 100MB.
Update
This question is not related to large size of apk due to Flutter. The apk is huge because of the assets used in the app. Want to know the process of uploading such apps in Flutter. In native android development we have the option of expansion files as shown in the link. IS there a similar option for Flutter if not what is the process to upload such apps to google play store.
When building a release version of your app, consider using the --split-debug-info tag. This tag can dramatically reduce code size. For an example of using this tag, see Obfuscating Dart code.
Some of the other things you can do to make your app smaller are:
Remove unused resources
Minimize resource imported from libraries
Support a limited number of screen densities
Compress PNG and JPEG files
or
One way that i use to reduce my app size is to use;
flutter clean
before i run the build command;
flutter build appbundle --target-platform android-arm,android-arm64
Use an appbundle and you get 150mb
https://developer.android.com/guide/app-bundle
use Firebase Storage to download the content (12 cents per gig)
https://firebase.google.com/pricing
or follow the Expansion files inclusion in Flutter (it is very quiet at the moment)
https://github.com/flutter/website/issues/2215
use this command to create multiple small size apk then upload multiple apk in play store
flutter build apk --split-per-abi
Use Deferred components for app-bundle generation if you have larger apk in flutter.
This feature is currently only available on Android, taking advantage
of Android and Google Play Stores’ dynamic feature modules to deliver
the deferred components packaged as Android modules. Deferred code
does not impact other platforms, which continue to build as normal
with all deferred components and assets included at initial install
time
I agree with #RĂ©miRousselet maybe you can check your assets and tell us if that's the case. But if it's not, then maybe it's a package issue.
But as an FYI, Flutter team has an answer for big size APK. Check this. Also check this to know the minimum size of Flutter that they came up with. It was stated that,
we measured the size of a minimal Flutter app (no Material Components, just a single Center widget, built with flutter build apk), bundled and compressed as a release APK, to be approximately 4.48MB.
Judging from that statement, the Flutter APK is really large and it has a fixed overhead size.
Here are some reference you can check regarding how to reduce APK size.
Reduce --release apk and ipa sizes
Would like an article which explains how to reduce APK size
Also check this StackOverflow question related to yours.

Android aapt add command fails when zip file reaches a particular size

I am having an issue with adding a large amount of video files to an APK. First it's worth mentioning this APK will not go on the Play store so there are no limits in APK size in principal.
Essentially when building for Android with Unity I noticed once the videos files combined passed the 2 GB mark, they would fail when the APK was being packaged as a Zip.
I decided to remove the video files and build the APK without them and then try using the aapt build tool in CMD to manually add each video. It appears that when using this tool I hit the same issue as in Unity at the 2GB mark.
Does anyone know why I seem to be receiving the below message when the content reaches the 2GB total size mark? Is there a logical limit, can I bypass it somehow? Is it maybe something else that is misleading me?
C:\Users\B\AppData\Local\Android\sdk\build-tools\26.0.1>aapt add -v `"C:\Users\B\Desktop\0.0.7.apk.zip" "C:\Users\B\Downloads\LE_ACT_3.mp4"`
ERROR: failed opening/creating 'C:\Users\B\Desktop\0.0.7.apk.zip' as Zip file
Thanks and happy to take advice on how to package up another way also.
Its due to the expansion file size limit for Android APK's, which is 2GB. 2GB for the main expansion and 2GB for the patch equals 4GB. I can rest easy but it's made life harder for me.

Android Studio Install vs. Google Play Install (App Size on Device)

I seem to be having a problem with limiting the size of my installed Android Application. During development I used Android Studio to deploy my application to my testing device. The app took a total of 2.32 MB in storage when freshly installed.
The problem in size came up when I published my application to the Google Play Store for alpha testing. I uninstalled the same app I had loaded with Android Studio, then downloaded the one I listed on the Google Play Store. The funny thing is that the same app now takes up 4.11 MB in storage.
How did this occur? The testing environment is the same, therefore what additional libraries or information would need to be added to the app causing it to take up the extra 1.79 MB?
TL;DR
App installed on testing device via Android Studio: 2.32 MB in storage
Same app installed on the same testing device through the Google Play Store: 4.11 MB in storage
Why is there such a significant increase in the size of my application? No other variables aside from installation source have changed.
That's because compiling & installing app into one target device and all devices is different.
When you click the run button, you are targeting only single device.
When deploying a signed release apk, you are targeting all screen densities, intel and arm processors. It includes extra files. It makes your apk file bigger.
Check out this existing answer on SO. Android release apk bigger than debug
The answers point out how a debug version only includes resources for the connected devices screen density. For production all images/res are included. Also, you should be able to further reduce size of your apk by using pro guard if you aren't already.

Categories

Resources