Setting Up Android App Bundle (AAB) for Size Optimization

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Setting Up Android App Bundle (AAB) for Size Optimization
Medium
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Setting Up Android App Bundle (AAB) for Size Optimization

Since August 2021, Google Play requires AAB instead of APK for new applications. But simply switching build format from APK to AAB — insufficient for real size reduction. Need to understand how Google Play Asset Delivery works, configure splits and remove from base module everything that shouldn't be there.

How AAB Reduces Size

APK — single file for all devices. AAB — archive with modules, from which Google Play builds optimized APK for specific device. Samsung Galaxy S23 with arm64-v8a and xxhdpi screen gets only arm64-v8a native libraries and xxhdpi resources — without x86, armeabi-v7a and xhdpi/hdpi variants.

Downloaded APK size reduces on average 15–35% compared to universal APK — official Google data for real applications.

Configuration in build.gradle

android {
    bundle {
        language { enableSplit = true }    // separate APK per language
        density { enableSplit = true }     // separate APK per screen density
        abi { enableSplit = true }         // separate APK per CPU architecture
        texture {
            enableSplit = true
            defaultFormat = "ETC2"        // baseline format for Mali/Adreno
            // ASTC for flagships with support (Adreno 530+, Mali-G51+)
        }
    }
}

texture splits — especially important for games and 3D apps: ETC2 — universally supported (GLES 3.0+), ASTC — best compression on modern devices, DXT/S3TC — for x86 (ChromeOS). Without texture splits all formats packed together, can add +50–100 MB to size.

Size Check Through bundletool

bundletool build-apks --bundle=app.aab --output=app.apks \
    --ks=keystore.jks --ks-pass=pass:password \
    --ks-key-alias=key --key-pass=pass:password

bundletool get-size total --apks=app.apks \
    --device-spec=pixel7_spec.json

device-spec.json for specific device obtained through bundletool get-device-spec --adb=<path>. Gives exact size of downloadable APK for target device before uploading to Play Store.

R8 and ProGuard — Mandatory Companions to AAB

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

shrinkResources = true works only with minifyEnabled = true. Removes unused resources — strings, images, layouts — based on static code analysis. In real projects adds 5–20 MB additional reduction.

R8 in full mode (don't add -dontobfuscate for release) more aggressively removes code and inlines methods. proguard-android-optimize.txt instead of proguard-android.txt enables additional optimizations.

Size Analysis Through Android Studio

Build → Analyze APK (works with AAB through unpacking). Shows pie chart: classes.dex, res/, lib/, assets/. Immediately see what takes most space. Typical findings:

  • assets/ with uncompressed JSON data files — compress or move to binary format (Protobuf / FlatBuffers)
  • lib/ with native libraries for all ABI including x86 and x86_64 — keep only arm64-v8a and armeabi-v7a for production build
  • res/drawable-* with PNG where VectorDrawable enough

Timeframe

AAB setup with bundletool verification — 1–2 days. For full size optimization including R8 tuning and texture splits — 3–5 days.