Eight Effective Strategies to Reduce Android APK Size

Dynamic feature modules allow you to deliver parts of your app on demand. Users can request these modules at runtime, reducing the initial download size.

modelManager.fetchModule("dynamic_feature")
    .addOnFailureListener(e -> {
        // Handle download failure
    })
    .addOnSuccessListener(sessionId -> {
        // Module successfully downloaded
        currentSessionId = sessionId;
    });

Offer an Instant App Experience

Android Instant Apps let users try part of your application without installing it—ideal for users with limited storage or data constraints. Starting with Android Studio 3.2+, you can create URL-less Instant Apps, removing the need for domain verification and assetlinks.json.

To support Instant Apps, restructure your project in to:

  • App module: The installable APK.
  • Base module: Shared code and resources (e.g., launcher icon).
  • Feature modules: Self-contained functionalities.
  • Instant app module: Aggregates feature modules into an Instant App APK.

When creating a new project, select "This project will support instant apps" to auto-generate this structure.

For testing, use a physical device running Android 5.1+ or an emulator with Android 8.1+, x86 architecture, and Google APIs. In your run configuration, clear the URL field to test a URL-less Instant App.

Bundle Instant and Installlable Apps Together

With Android Studio 3.3+ and App Bundles (.aab), you can package both Instant and installable versions in one artifact.

In your instantapp module’s AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dist="http://schemas.android.com/apk/distribution"
    android:targetSandboxVersion="2">
    <dist:module dist:instant="true" />
</manifest>

In the app module’s build.gradle, ensure the instant variant has a lower versionCode:

android {
    flavorDimensions "releaseType"
    productFlavors {
        instant { versionCode 1 }
        installed { versionCode 2 }
    }
}

Build and sign the bundle via Build > Generate Signed Bundle / APK.

Remove Unused Code and Resources

Unused assets bloat your APK. Use these tools to eliminate them:

Enable R8 (Recommended)

R8 replaces ProGuard as the default shrinker. To enable it explicit (though it’s on by default in newer AGP versions):

android.enableR8=true

Use ProGuard (Legacy)

If not using R8:

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

Shrink Resources

Add shrinkResources true alongside code shrinking:

buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

Run Lint for Unused Resources

Use Analyze > Inspect Code to find unreferenced resources. Lint reports them but doesn’t delete—manual cleanup is required.

Convert Images to WebP

If your minSdkVersion ≥ 18, convert PNG, JPEG, and BMP files to WebP for better compression. Right-click drawable folders in Android Studio, choose Convert to WebP, and select lossy or lossless encoding.

Analyze APK with APK Analyzer

Use Build > Analyze APK to inspect file sizes. The tool shows:

  • Raw size: Uncompressed size on disk.
  • Download size: Estimated compressed size from Play Store.
  • Percentage of total: Contribution to overall APK size.

You can also compare two APKs to spot size regressions between versions via Compare with APK... in the analyzer toolbar.

Optimize for Android Go

Android Go targets devices with ≤1GB RAM. Google Play highlights apps under 40MB optimized for Go.

To publish a Go-specific APK:

  • Use the same package name and signing key as your main app.
  • Assign a unique, higher versionCode.
  • Add to your manifest:
<uses-feature android:name="androix.feature.low_ram" android:required="true" />

Use multi-APK delivery to serve this lightweight variant only to eligible devices.

Tags: Android APK Optimization Instant Apps App Bundle r8

Posted on Sun, 16 Aug 2026 17:03:48 +0000 by mogster