Master APK Size Optimization with Android Studio’s APK Analyzer
This guide explains how Android Studio's APK Analyzer lets developers inspect APK composition, view file sizes, explore DEX contents, examine manifests, compare builds, and ultimately reduce app size and debugging effort.
Android Studio 2.2 includes APK Analyzer, which lets you visually inspect the composition of an APK, helping reduce debugging time and APK size.
View absolute and relative sizes of files inside the APK.
Understand the composition of DEX files.
Inspect final versions of files such as AndroidManifest.xml and resources.arsc.
Compare two APKs to see size differences.
There are three ways to open APK Analyzer: drag the APK into the editor window, double‑click the APK in Project view, or choose Build > Analyze APK from the menu.
Note: When analyzing a debug APK, use the one generated by Build > Build APK. The APK produced by Run (Instant Run) cannot be analyzed because it contains an instant‑run.zip file.
Viewing File and Size Information
An APK is a zip archive. APK Analyzer shows each file or directory as an entity, displaying raw file size (uncompressed on disk) and download size (compressed for Google Play), as well as the percentage of total download size.
Viewing AndroidManifest.xml
If the project contains multiple manifests or library manifests, they are merged into a single file. APK Analyzer displays the merged manifest in XML form, allowing you to see how library manifests contribute and to view lint warnings and errors.
Viewing Code and Resource Entities
Different build tasks affect the final APK entities. Clicking an entity shows its content, including text previews of images. Resources.arsc can be inspected to view configuration‑specific values such as translated strings.
Viewing DEX Files
The DEX file browser lists classes, packages, and the counts of defined and referenced methods, helping decide whether to use multidex or remove dependencies to stay under the 64K method limit.
Comparing APK Files
APK Analyzer can compare two APKs side by side. Load the new APK, click “Compare With” in the top‑right, select the previous version, and view differences in entity sizes, such as between debug and release builds.
Tencent TDS Service
TDS Service offers client and web front‑end developers and operators an intelligent low‑code platform, cross‑platform development framework, universal release platform, runtime container engine, monitoring and analysis platform, and a security‑privacy compliance suite.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
