Your APK can contain content that users download but never use, like regional or language information. To create a minimal download for your users, you can segment your app into several APKs, differentiated by factors such as screen size or GPU texture support.
Here are Some ways to Reduce Apk File size:
Here are Some ways to Reduce Apk File size:
- Use ProGaurd
- Remove any debug info you have in the app ( statements such as Log.i()). They can be wrapped in a condition which is only enabled while testing out the application.
- Use recommended media formats
- Image: PNG,JPG & WebP
- Audio: AAC
- Video: H264 AVC
- Compress images using OptiPNG or PNGCrush
- Use 9patch to scale images
- Find unused resources and remove them.
- Refrain using multiple resources to achieve the same functionality. The resources is not limited to images but can be extended to APIs. Sometimes, using a singular API which provide multiple results is more efficient than using two or three different APIs. Duplicated strings and assets are also a waste of memory.
- Libraries that you add to your code may include unused resources. Gradle can automatically remove resources on your behalf if you enable
shrinkResources
in your app'sbuild.gradle
file.
android { // Other settings buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
Comments
Post a Comment