Mobile Development 21 min read

Android App Size Reduction: Offline Attachment Framework and Resource Separation Strategy

This article details a comprehensive Android app slimming initiative that reduces package size from 144 MB to 70 MB by separating large resources into offline attachment zip files, implementing an automated download framework, achieving seamless resource replacement, and eliminating heavy Unity 3D components while addressing numerous technical challenges.

Xueersi Online School Tech Team
Xueersi Online School Tech Team
Xueersi Online School Tech Team
Android App Size Reduction: Offline Attachment Framework and Resource Separation Strategy

The team needed to shrink the app package because a larger size increased promotion costs and lowered conversion rates; the goal was to cut the 144 MB app down to around 70 MB.

Plugin‑based modularization was abandoned after two failed experiments due to incompatibility across many Android ROMs, high maintenance overhead for resource IDs, data‑transfer and permission issues, and upcoming restrictions on ClassLoader usage.

Reducing the package required handling over 20 sub‑projects, supporting Android 4.4 to the latest versions, and delivering a lightweight, unified framework within a tight two‑week development and testing schedule.

Resource analysis showed roughly 70 MB of images, Lottie animations, and native libraries, plus 6 MB of small files, prompting the idea of moving these assets to the cloud and downloading them on demand.

The proposed attachment framework keeps resources in the app for development but separates them at release, automatically downloading the required zip files before a feature is entered, and providing transparent access to the downloaded assets.

Key features of the framework include automated script‑driven resource separation per module, on‑demand and pre‑load downloading based on business weight, unified interception of resource requests to avoid code changes, seamless replacement of drawables, Lottie, and Glide assets, incremental updates reducing download size by 95 %, multi‑cloud backup with retry logic, and comprehensive logging.

Implementation steps involve defining an <com.parentsmettins.drawable.ReplaceDrawable file="project/imagePath"/> tag for drawable replacement, using Gradle scripts to generate an attach directory per module, packaging resources into zip files during Jenkins releases, and publishing them via automated Python scripts to both internal and Tencent clouds.

Additional challenges such as handling Unity 3D removal, drawable and Lottie seamless replacement, library loading permissions, download interception across various navigation mechanisms, resource naming conflicts, WebView crashes, and Glide local image loading were systematically solved through custom resource stream overrides, decorator patterns, and URI handling.

Ultimately, the solution achieved full Android standard compatibility, eliminated the need for plugin‑style maintenance, enabled incremental updates for existing users, automated packaging and publishing, and ensured that future feature additions no longer cause app bloat.

mobile developmentAndroidresource managementdownload-frameworkapp-sizeoffline-attachmentunity-removal
Xueersi Online School Tech Team
Written by

Xueersi Online School Tech Team

The Xueersi Online School Tech Team, dedicated to innovating and promoting internet education technology.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.