Since its launch in 2012, the Android market has been taken by storm in the tech world. What has to be noted here is that the size of the average Android app has quintupled over this period. The highly competitive market of android developers have delivered better user experience in their apps with high-deﬁnition graphics, innovative features and rich multimedia content, which has resulted in the increase of the android app size. To compensate this, our devices have also expanded the typical memory space available in an android device. However, it has been observed that there is a negative impact on android users, because no-one wants an app that takes forever to download and then takes a chunk out of their device’s memory! So here are 7 pro tips we have have sorted out for you developers out there to create a trimmer, slimmer APK which will encourage more users to download your app and ensure your app winds up on as many devices as possible.
1. Attain a smaller image size without compromising the quality by switching to .webp image format.
2. Dead code is directly linked with the load speed of the app, hence making it slow.
3. Lint tool is a static code analyser that detects and removes unused resources and class.
4.Reusing of resources had many beneﬁts and is better than removing them.
5. Minimise the use of space by supporting for speciﬁed screen densities.
6. Shrink the size of the release version of the app by reducing the size of native binaries.
7. Effective ways to scan and reduce android app size after coding, using APK Size Analyser.
Additionally, there are few other ways you can attain a smaller image size without compromising the quality by :
*Use drawable shapes
*Compress .JPG and . PNG ﬁles
*Use vector graphics for simple images
*Use Draw 9-patch tool to create bitmap images
Dead Code Elimination:
Elimination of any unused and inoperative code is essential for an APK ﬁle to stay energised and reduce the launch time of the app improving the functionality of the source code and lowering the need to maintain code size.
The bonus here is the prevention of introductory bugs while manifesting a healthy app on the whole.
Removal of unused resources and class:
The lint tool detects resources in the folder that your code doesn’t reference. This tool only detects potentially unused resources and prints a message.
Additionally, you can enable resource shrinking and shrink code using Proguard.
Reuse of Resources:
Instead of using different resources, utilise one resource in different manners. Reusing resources further helps in keeping the scrolling performance of an app optimum and reducing its size considerably. Yet, some resources can be omitted, which are only a rotated equivalent of another.
Support for specific screen densities:
There are a million Android enabled devices with varied screen densities. However, you do not need all of them for your app. To eliminate bundling all these screen densities into your app, just make a survey to identify the percentage of users with devices that have speciﬁc densities. If this percentage is insigniﬁcant, you have a reason to remove them and lighten your app size.
Reduction of the size of native binaries:
To reduce the quantity of Native and Java codebase as well as shrink the size of the release version of your app, follow the 2 steps below :
*Use the arm-eabi-strip tool, provided in the Android NDK, to remove unnecessary debug symbols.
*By setting android:extractNativeLibs=”false, avoid extracting native libraries.
Utilisation of APK Size Analyser:
APK Size Analyser is the easiest way to ﬁnd out and scan your app after coding, which can be initiated by following 2 methods.
*Using the plugin marketplace in the Android Studio
*By downloading the APK Size Analyzer from GitHub, use the command line to scan the app for size optimisation.