less consumed data. (slow connections, costly/limited data fees) - Smaller install size on the device. (most entry-level phones only have 8 Gb of storage)
Google Play Services. dependencies { compile 'com.google.android.gms:play-services:9.0.2' } Only declare the modules you need. dependencies { compile 'com.google.android.gms:play-services-maps:9.0.2' compile 'com.google.android.gms:play-services-location:9.0.2' compile 'com.google.android.gms:play-services-gcm:9.0.2' }
release { minifyEnabled true proguardFiles getDefaultProguardFile(‘proguard-android. txt'), 'proguard-rules.pro' } } } - Big apps: multidex for debug, Proguard for release. - Add Proguard rules (if any) for each library you’re using. Many libraries already include Proguard rules inside their .aar file. - Avoid using reflection in your code. Else, add Proguard rules for it.
APK by CPU architecture Create one APK file for each CPU architecture. android { ... splits { abi { enable true reset() include 'x86', 'armeabi-v7a', 'mips' universalApk false } } }
using tools like Mac OS X: ImageOptim Linux: Trimage Windows: FileOptimizer. - Then disable automatic PNG optimization. Because it makes already optimized files bigger (issue 65335). android { aaptOptions { cruncherEnabled false } }
files (Android 4+). Same quality, 33% smaller file size. - Replace small PNG icons with Vector Drawables and enable full VectorDrawable support in the support library 23.2+: android { defaultConfig { vectorDrawables.useSupportLibrary = true } } - More image optimizations: medium.com/@duhroach
Play Services include many strings in 75+ languages. - Specify the locales you support, the build tool will remove the rest. - Expect gaining a few hundred kilobytes. android { defaultConfig { ... resConfigs "en", "fr", "nl" } }