I want to calculate the space the installed APK needs before the APK installs.
Is it possible?
yes it is possible , you can check this by simply taking ur apk and using analyse ANDROID STUDIO->BUILD->ANALYSE APK tool to see approximate size your apps would take and see exactly why ( available only in android 2.2 and above). and if you simply want to know your apk size,you can simply right click on it and see properties for size.However i like to consider +10% margin to consider space on target device just as buffer.
And if you are talking about space taken up by the data of resources your app will write onto the storage,then that totally depends on your to be stored data size and overheads of storing it
if your looking for phone memory resources stats, you should try using tools such as systrace and memory trace tools available in android studio and run your app on emulator or device to see real time usages
Related
I had combed through a number of medium articles, the official Android documentation, and this thread to find ways to reduce the size of the hello world app generated by Android Studio. Unfortunately, the most common strategy, which is to enable Proguard to minify and shrink resources, hasn't done anything to reduce the size of the installed app. I'm also using the size of the app installed rather than the apk for my point of reference. And the size of the app generated comes out to a little over 5MB, which is over 5x more than what the person in the other thread cited. Any help would be much appreciated. I had tried installing this on a number of devices running KitKat, Lollipop and Nougat. I'm not sure if this is the cost of using a newer version of Android Studio (3.2.1) or newer tooling in general or if there are ways to optimize this code to bring this down to the size of Google Hangouts dialer, which is only 108KB (again, installed, not apk), even though it has considerably more assets and more functionality than a hello world app. Thanks.
My generated APK is around 6MB.
I am using ProGuard.
However, after installed into phone device, it takes up space around 60MB.
I would like to know, which dependencies cause huge installed space (60MB)
I look at How to check the size of dependencies in an android app? and https://medium.com/google-developers/making-the-most-of-the-apk-analyzer-c066cb871ea2
I use "Build → Analyze APK".
But, it can let me know where does 6MB (size of APK) come from. But, it doesn't let me know, why it does take up to 60MB in user phone.
Google tooks most of the method counts.
But, I don't think Java code with ~40,000 methods and reference ~50,000 methods, can consume up to 60MB space.
I had checked my assets folder and res folders. Their size is 2MB and 3MB respectively. Hence, I have no idea what is the major contribution to 60MB app installed size.
Is there any good way, to inspect and reduce app installed size?
When I install my app on my main/new phone, the installed size is around 18.5MB
and when I install my app on an old Samsung Galaxy Ace (Mk1), for some reason, it installs with pretty much the same size, as you see here:
It runs perfectly on my main phone, but obviously, the old Galaxy Ace really struggles with it.
Now, I download a random game from the Play Store and with that one you can see the results here:
Much better, it takes up less space on the less capable phone than it does on the more capable phone.
However, my question is, where can I start to try to figure out why my app doesn't exhibit this desired behaviour?
Information about my project
I have provided 4 sets of Graphics within my project and they are:
Graphics
XHDPI: Total of 3.73MB
HDPI: Total of 2.87MB
MDPI: Total of 1.33MB
LDPI: Total of 1.03MB
Sound
OGG Sound Files: 202KB
MP3 Soundtrack: 5.6MB
The (Unsigned and signed) APK file is about 16.02MB
Apart from that there is a classes.dex file within the APK which is about 3.5MB.
In Eclipse, I link BaseGameUtils and Google-play-service-lib jar files.
I know that my game is slightly more resource hungry than the other game I downloaded - but that isn't the point of this question. I need to make sure that the size of the installed app is smaller on lesser capable phones than it is 'better' ones but as you can see, mine is exactly the same.
Any help would be appreciated.
Edit
Additional information if it helps:
The Samsung Galaxy Ace is running Android 2.3.4 Gingerbread
The other phone is running Android 4.4.2 Kit Kat
the answer is the picture.. you see android apps can specify locations where apps are supposed to be installed, whether internal or external- you can do that in your android manifest file
android:installLocation="auto"
Looking at your app you from the settings screenshot you have not specified that element in your manifest hence the "move_to_sdCard button" is inactive. Your apps installs in internal memory
coming to the other app, looking at the screenshot you will see that the "move_to_phone button" is active because they specified that feature hence since there wasn't enough space on your device it automatically installed your app on the internal-external memory or strictly external memory.. But when that feature is set not all resources or files are installed on the internal-external memory they are shared, so the size gets trimmed in the process hence that ouput.
Speaking about the lag of your app, you need to digg into your codes pretty much. also newer apis contain functions the old ones do not have, hence you need to re-evaluate the kinds of codes you choose..
Hope i am lucid enough
Probably the "Other App" is using the Multiple APK technique to publish the App on the Play Store. With this feature you can build and deploy several apk(s) each targeting a specific device density screen. In this way you can reduce the apk dimension since each apk will have only the resources for his target and automatically the Play Store will deliver the correct one.
My current game project is getting large enough that when I deploy for testing I'm waiting a few minutes to actually get this to my phone. Sometimes I have other things to work on, but sometimes I have to sit and wait. This is unfortunately slowing down the development process.
I'm already sure the biggest factor in this is package size. My package is now just under 18 Megs, but I know there are apps out there with much larger packages.
Is there any tricks, phone settings, or eclipse settings that might speed deployment other than reducing the package size?
Regards.
While this doesn't quite meet your criteria of 'other than reducing the package size', my guess is that most of that filesize probably comes from textures and audio resources.
Instead of packing them all in the APK under the res/ folder, I might recommend temporarily copying the resources to the device's filesystem, and then load them from there instead of your resources. Then when you repeatedly upload your APK you don't have to keep transferring the same resources over and over.
If you load your resources from a mostly centralized location it should be just a couple lines of code change to change from loading from res to loading from a file. You can repackage them as resources again when your game is closer to release and you don't have to do so many iterations.
what you want is an android emulator. you can install the emulator as a Eclipse IDE plugin.
http://developer.android.com/tools/sdk/eclipse-adt.html
#"Unfortunately my system is so slow (and old) that the emulator runs like molasses in comparison to running the app on the actual device."
http://dev.blogs.nuxeo.com/2011/10/speeding-up-the-android-emulator.html
What should we do if the size of our Android application is more than max size? Currently the acceptable size for Android applications (i.e. <App>.apk) on the Android market is 50 MB.
If our <Application>.apk size is more than 50 MB then what's the alternative to follow on?
Try removing the resources from the project and changing the app so that the resources will be downloaded upon first app opening to the SD card...
It will take some time to develop the changes, but I don't think you really have a choice...
Note that Samsung devices have an even smaller size limit...
The first reason for .apk size growth is resources. The more specialized application gets on each configuration (screen sizes, orientations, densitites etc) the more .apk size grows. Usually .apk still has size much less then 50 mb limits, but even with 20mb users may perceive your application as heavy.
Android Market added support for multiple .apk per application. This feature was designed to specifically address the issue of .apk size growth due to many different configuration. You can read more about it in Multiple APK Support in Android Market post from official Android blog. Though this is considered as last resort.
If you .apk size is large due to other reasons, then you're most likely doing something wrong. If its some embedded video/audio file (or even files!), consider moving them to web and download when user needs them for the first time. This will save internal memory space which is might be critical to users (especially on older devices).
I can't image why an application would be more than 50 mb from just the source code alone. If alot of the size is in design elements(images, etc) or data(database files), you could always have the user download this info when the application is first run.
if you are using Android 2.3.3 version then minimum size of the application must be minimum 9MB and maximum size is depend upon the device,the capacity of memory of the device. but if you take it 50 MB then no problem, its disadvantage is only that the AVD takes time to start.i don't know the Android Market place current application size.