MyFamilyTracker
Real-time family location sharing — Firebase Realtime DB for sub-second propagation, WorkManager + ForegroundService for OS-compliant background collection, geofencing via Google Maps API.
App size directly affects install rates and user retention. Every extra MB costs you installs. Here's a systematic approach to analyzing and reducing Android app size using R8, App Bundles, and resource optimization.
On this page
Users abandon app installs when they see the download size. Google data shows install rates drop significantly above 10MB on low-end devices and limited data plans. App size is a user acquisition problem.
Here's how to fix it systematically.
You can't optimize what you don't measure. Android Studio's APK Analyzer shows exactly where your bytes are going:
Build → Generate Signed Bundle/APK → then: Build → Analyze APK
Or via Gradle:
./gradlew assembleRelease
# Then open: app/build/outputs/apk/release/app-release.apk in APK AnalyzerThe breakdown typically shows:
classes.dexres/lib/assets/Find the biggest categories. Fix those first.
R8 is the code shrinker and obfuscator, enabled by default for release builds:
// build.gradle.kts
android {
buildTypes {
release {
isMinifyEnabled = true // Enables R8
isShrinkResources = true // Removes unused resources
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}R8 does three things:
A typical app might shrink from 8MB to 4MB with R8 enabled.
App Bundle lets Google generate optimized APKs per device. A user gets only:
Result: 15-50% smaller installs for users.
// This is already set correctly for Play Store submissions
// App → Generate Signed Bundle → Android App Bundle[!IMPORTANT] The Play Store requires App Bundle format since August 2021 for new apps. If you're still uploading APKs to the Play Store, you're missing significant size savings and leaving compliance issues on the table.
Images are often the biggest contributor to app size.
WebP instead of PNG/JPEG:
Android Studio can convert automatically: Right-click image folder → Convert to WebP
WebP provides better compression than PNG for lossless and JPEG for lossy, with the same visual quality.
Remove unused drawables:
# Find potentially unused resources
./gradlew lint
# Look for "UnusedResources" warningsR8's
isShrinkResources = trueVector drawables instead of PNG:
For icons and simple graphics, vector drawables (
VectorDrawable<!-- One file instead of mdpi/hdpi/xhdpi/xxhdpi PNGs -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="24"
android:viewportHeight="24"
android:width="24dp"
android:height="24dp">
<path android:pathData="M12,2L..." android:fillColor="@color/icon_tint"/>
</vector>Each dependency adds to your DEX size. Check what you're actually using:
// Remove dependencies you're not using
// Replace heavy dependencies with lighter alternatives
// Example: instead of all of Guava (2MB+) for one utility:
// Bad
implementation("com.google.guava:guava:33.0.0-android")
// Good — use only the specific Kotlin stdlib equivalentCheck your APK's
classes.dexIf your app uses native libraries (
.so// If you only support 64-bit devices (Android 5.0+)
android {
defaultConfig {
ndk {
abiFilters += listOf("arm64-v8a")
}
}
}For most apps in 2026, shipping only
arm64-v8aNot size reduction, but perceived size — Baseline Profiles speed up first launch by pre-compiling hot code paths:
// baseline-prof.txt (generated by Macrobenchmark)
HSPLcom/yourapp/MainActivity;-><init>()V
HSPLcom/yourapp/TaskListViewModel;->loadTasks()V
// ...Users open the app faster. This compensates for size in user perception.
| Action | Typical Savings |
|---|---|
| Enable R8 + resource shrinking | 30-50% |
| Switch to App Bundle | 15-40% reduction in user-facing size |
| Convert images to WebP | 10-30% on image-heavy apps |
| Replace PNGs with VectorDrawable | 50%+ for icon sets |
| Remove unused dependencies | Variable, 1-10MB possible |
| Limit ABI to arm64-v8a | 20-40% for apps with native libs |
Set a size budget in CI:
# After building release AAB
AAB_SIZE=$(stat -c%s app/build/outputs/bundle/release/app-release.aab)
MAX_SIZE=10485760 # 10MB
if [ $AAB_SIZE -gt $MAX_SIZE ]; then
echo "AAB size ${AAB_SIZE} exceeds budget ${MAX_SIZE}"
exit 1
fiThis prevents size regressions slipping in unnoticed with new dependencies.
Sudarshan Chaudhari
AI Systems Builder / Product Engineer
Bangkok, Thailand
Solo Android developer with 13+ years in QA, building Android apps, AI automation systems, and developer tools at SudarshanTechLabs.
Related Posts
Related Apps
Real-time family location sharing — Firebase Realtime DB for sub-second propagation, WorkManager + ForegroundService for OS-compliant background collection, geofencing via Google Maps API.
Building something? Available for Android dev and QA consulting.
Work with meComments — powered by Giscus