App Sizer is a tool designed to analyze the download size of Android applications. By providing detailed insights into the composition of your app's binary, App Sizer helps developers identify areas for size reduction, ultimately improving user acquisition and retention rates.
The app download size in Android refers to the amount of data a user needs to download from an app store (typically Google Play Store) to install an application on their Android device
App Sizer currently supports three types of reports:
InfluxDB database (1.x) - It is suitable for CI tracking and enabling the creation of customized dashboards (with visualization tools like Grafana). We provide an InfluxDB and Grafana setup; see our Docker Setup Guide.
Markdown table for convenient local analysis.
JSON data for compatibility with other platforms.
The Markdown & Json reports are saved as [option]-report.md in the configured output folder (default: app/build/sizer/reports)
App Sizer approximates class download sizes due to Dex structure complexity, and may not accurately attribute sizes for inline functions or uncategorized files. Results should be interpreted as close estimates, best used for identifying trends and relative size comparisons rather than exact measurements.
For more details on limitations, see the Limitation.
App Sizer is a tool designed to analyze the download size of Android applications. By providing detailed insights into the composition of your app's binary, App Sizer helps developers identify areas for size reduction, ultimately improving user acquisition and retention rates.
The app download size in Android refers to the amount of data a user needs to download from an app store (typically Google Play Store) to install an application on their Android device
App Sizer currently supports three types of reports:
InfluxDB database (1.x) - It is suitable for CI tracking and enabling the creation of customized dashboards (with visualization tools like Grafana). We provide an InfluxDB and Grafana setup; see our Docker Setup Guide.
Markdown table for convenient local analysis.
JSON data for compatibility with other platforms.
The Markdown & Json reports are saved as [option]-report.md in the configured output folder (default: app/build/sizer/reports)
App Sizer approximates class download sizes due to Dex structure complexity, and may not accurately attribute sizes for inline functions or uncategorized files. Results should be interpreted as close estimates, best used for identifying trends and relative size comparisons rather than exact measurements.
For more details on limitations, see the Limitation.
App Sizer is a tool designed to analyze the download size of Android applications. By providing detailed insights into the composition of your app's binary, App Sizer helps developers identify areas for size reduction, ultimately improving user acquisition and retention rates.
The app download size in Android refers to the amount of data a user needs to download from an app store (typically Google Play Store) to install an application on their Android device
App Sizer currently supports three types of reports:
InfluxDB database (1.x) - It is suitable for CI tracking and enabling the creation of customized dashboards (with visualization tools like Grafana). We provide an InfluxDB and Grafana setup; see our Docker Setup Guide.
Markdown table for convenient local analysis.
JSON data for compatibility with other platforms.
The Markdown & Json reports are saved as [option]-report.md in the configured output folder (default: app/build/sizer/reports)
For more detail on reports, see Report Detail
"},{"location":"#how-it-works","title":"How it works","text":"
App Sizer functions as a mapping tool to generate the report. It takes APK, AAR, and JAR files as inputs.
Input parsing:
The tool parses the APK down to file and class levels. It calculates the contribution of each component to the total app download size.
Similarly, App Sizer parses AAR and JAR files.
Mapping and Report Generation:
The tool then maps the APK components to their corresponding elements in the AAR and JAR files.
Based on this analysis and other metadata, App Sizer generates comprehensive reports detailing size contributions.
App Sizer approximates class download sizes due to Dex structure complexity, and may not accurately attribute sizes for inline functions or uncategorized files. Results should be interpreted as close estimates, best used for identifying trends and relative size comparisons rather than exact measurements.
For more details on limitations, see the Limitation.
MIT License\n\n\nCopyright 2024 Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE\n
The App Sizer CLI accepts a YAML file as configuration (template). The file consists of three main blocks:
project-input:\n # Configure the input for the project\napk-generation:\n # APK Generation configuration\nreport:\n # Output Configuration\n
"},{"location":"cli/#project-input","title":"Project Input","text":"Property Description libraries-directory Path to all SDK & library binaries that your project depends on. In Gradle, you can save all dependencies in a folder by setting a new Gradle home path for your build with the -g option. Example: ./gradlew assembleRelease -g ./new-gradle. Then all dependency binaries will be saved to ./new-gradle/caches/modules-2/files-2.1 modules-directory Path to all of your modules' AAR & Jar files. In Gradle, you can run assembleDebug in the project root folder to build all AAR/Jar files, then set the root folder for this property modules-dir-is-project-root Boolean value. Enable this flag if you set the root project as the modules-directory to optimize performance r8-mapping-file Path to the R8 mapping file if you enable R8 for your build owner-mapping-file Path to YAML file mapping project modules to team owners version Your app version large-file-threshold File size threshold (in bytes) for considering a file as large project-name Project name
"},{"location":"cli/#apk-generation","title":"APK Generation","text":"Property Description bundle-tool Path to the bundletool JAR file app-bundle-file Path to the app bundle file (aab) device-specs List of device specification files for APK generation key-signing Key signing information"},{"location":"cli/#output-configuration","title":"Output Configuration","text":"Property Description output-directory Directory to save markdown and JSON reports custom-attributes Map of additional attributes to include in every report row influx-db-config InfluxDB configuration (see below)"},{"location":"cli/#influxdb-configuration","title":"InfluxDB Configuration","text":"Property Description url URL of the InfluxDB server db-name Name of the InfluxDB database report-table-name Measurement name for storing report data username InfluxDB username (optional) password InfluxDB password (optional) retention-policy InfluxDB retention policy configuration (optional)"},{"location":"cli/#full-configuration-example","title":"Full Configuration Example","text":"
App Sizer is a powerful tool, but it has some limitations that users should be aware of. This document outlines the key limitations and explains their impact on the analysis results.
Calculating the exact download size of a class from an APK is challenging. App Sizer uses an approximation method:
We obtain a relative size of the class definition (termed 'raw size').
We use the Dex file download size that the class belongs to.
We derive a relative value for the class's download size using the formula:
class's download size = class raw size * (dex download size / all classes' raw size)\n
This approach provides a reasonable estimation but may not be 100% accurate. Interestingly, similar tools in the community have independently developed comparable methods.
"},{"location":"limitation/#files-grouped-under-others","title":"Files Grouped Under \"Others\"","text":""},{"location":"limitation/#resourcesarsc-file","title":"resources.arsc File","text":"
The resources.arsc file is a special file in Android APKs containing precompiled resources (such as binary XML for strings, arrays, and other value types) in a binary format for efficient access.
App Sizer does not analyze this file individually.
It's grouped under the \"Others\" category.
For small Android projects, this can disproportionately impact the data, potentially creating the illusion of an inefficient analysis.
Any files that cannot be categorized as Java/Kotlin code, resources, native libraries, or assets are automatically distributed to the app module and grouped under the \"Others\" category.
Any files/classes that cannot find an owner (does not belong to a module or library) are automatically distributed to the app module
"},{"location":"limitation/#inline-functions-and-classes","title":"Inline Functions and Classes","text":"
The nature of inline functions and inline value classes in Kotlin presents a unique challenge:
The size contributed by inline elements is calculated and distributed to where they are used, not where the inline methods/classes are created.
Build systems or optimization tools like R8 might rewrite code for efficiency, including inlining methods, which can result in similar outcomes to inline functions.
This behavior can make it difficult to accurately attribute size contributions to specific modules or libraries.
"},{"location":"limitation/#impact-on-analysis","title":"Impact on Analysis","text":"
These limitations mean that App Sizer's results should be interpreted as close approximations rather than exact measurements. They are most useful for:
Identifying trends in app size growth
Comparing relative size contributions of different components
Spotting large, unexpected size increases
Users should keep these limitations in mind when making decisions based on App Sizer's output, especially for small projects or when dealing with inline-heavy codebases.
Use the registered appSizer extension block to the app module's build.gradle to configure App Sizer Plugin
appSizer {\n enabled = true\n projectInput {\n // config the input for the plugin\n }\n metrics {\n // config the output for the plugin\n }\n}\n
* enabled: Given the App Sizer Plugin has not supported configuration on demand & configuration catching. We provide you an option to turned of the plugin just in case it impact your gradle configuration performance."},{"location":"plugin/#project-input","title":"Project Input","text":"
Property Description largeFileThreshold File size threshold (in bytes) for considering a file as large. teamMappingFile YAML file mapping project modules to team owners. enableMatchDebugVariant If true, uses debug AAR files to improve build performance. variantFilter Specifies which variants to exclude from analysis.
Property Description deviceSpecs List of device specification files for APK generation. bundleToolFile Path to the bundletool JAR file."},{"location":"plugin/#output-configuration","title":"Output Configuration","text":"
Property Description local.outputDirectory Directory to save markdown and JSON reports (default is app/build/sizer/reports) customAttributes Map of additional attributes to include in every report row. Such as pipeline-id, etc"},{"location":"plugin/#influxdb-configuration","title":"InfluxDB Configuration","text":"Property Description dbName Name of the InfluxDB database. reportTableName Measurement name for storing report data. url URL of the InfluxDB server. username InfluxDB username (optional). password InfluxDB password (optional). retentionPolicy InfluxDB retention policy configuration (optional)."},{"location":"plugin/#full-configuration-example","title":"Full Configuration Example","text":"
If you encounter issues with the verifyResourceRelease task, try these solutions: - Check that your resource files are properly formatted and located - Verify that resource names follow Android naming conventions - Enable the enableMatchDebugVariant flag in your configuration
A default App Download Size Breakdown dashboard is included in the Grafana docker instance. If you have an existing InfluxDB and Grafana setup, you can import our dashboard using this JSON file. Our blogpost introduce the provided dashboards
Markdown tables provide a convenient format for local analysis. The report is saved as [option]-report.md in the configured output folder (default: app/build/sizer/reports).
Each object in the array represents a single database row and contains the following properties:
name: The measurement name (e.g., \"apk\")
fields: An array of fields containing numerical or custom data
tags: Each measurement includes relevant tags such as the project name, app version, build type, and device name, allowing for detailed analysis and filtering of the data.
timestamp: Unix timestamp (in milliseconds) when the measurement was taken
"},{"location":"report/#using-the-json-report","title":"Using the JSON Report","text":"
The JSON format makes it easy to:
Import the data into various tools/databases
Integrate with other CI/CD processes
Perform programmatic analysis of app size trends over time
You can parse this JSON data using any standard JSON library in your preferred programming language to extract and analyze the information as needed for your project.
You can customize the reports by modifying the configuration in your Gradle plugin or CLI tool setup. For more details, refer to the Plugin Configuration or CLI Configuration guides.
flowchart TD\n A(generateApkDebug)\n B(generateArchiveDepDebug)\n C(appSizeAnalysisDebug)\n\n\n C --> A\n C --> B
"}]}
\ No newline at end of file
+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"App Sizer","text":""},{"location":"#overview","title":"Overview","text":"
App Sizer is a tool designed to analyze the download size of Android applications. By providing detailed insights into the composition of your app's binary, App Sizer helps developers identify areas for size reduction, ultimately improving user acquisition and retention rates.
The app download size in Android refers to the amount of data a user needs to download from an app store (typically Google Play Store) to install an application on their Android device
App Sizer currently supports three types of reports:
InfluxDB database (1.x) - It is suitable for CI tracking and enabling the creation of customized dashboards (with visualization tools like Grafana). We provide an InfluxDB and Grafana setup; see our Docker Setup Guide.
Markdown table for convenient local analysis.
JSON data for compatibility with other platforms.
The Markdown & Json reports are saved as [option]-report.md in the configured output folder (default: app/build/sizer/reports)
For more detail on reports, see Report Detail
"},{"location":"#how-it-works","title":"How it works","text":"
App Sizer functions as a mapping tool to generate the report. It takes APK, AAR, and JAR files as inputs.
Input parsing:
The tool parses the APK down to file and class levels. It calculates the contribution of each component to the total app download size.
Similarly, App Sizer parses AAR and JAR files.
Mapping and Report Generation:
The tool then maps the APK components to their corresponding elements in the AAR and JAR files.
Based on this analysis and other metadata, App Sizer generates comprehensive reports detailing size contributions.
App Sizer approximates class download sizes due to Dex structure complexity, and may not accurately attribute sizes for inline functions or uncategorized files. Results should be interpreted as close estimates, best used for identifying trends and relative size comparisons rather than exact measurements.
For more details on limitations, see the Limitation.
MIT License\n\n\nCopyright 2024 Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE\n
The App Sizer CLI accepts a YAML file as configuration (template). The file consists of three main blocks:
project-input:\n # Configure the input for the project\napk-generation:\n # APK Generation configuration\nreport:\n # Output Configuration\n
"},{"location":"cli/#project-input","title":"Project Input","text":"Property Description libraries-directory Path to all SDK & library binaries that your project depends on. In Gradle, you can save all dependencies in a folder by setting a new Gradle home path for your build with the -g option. Example: ./gradlew assembleRelease -g ./new-gradle. Then all dependency binaries will be saved to ./new-gradle/caches/modules-2/files-2.1 modules-directory Path to all of your modules' AAR & Jar files. In Gradle, you can run assembleDebug in the project root folder to build all AAR/Jar files, then set the root folder for this property modules-dir-is-project-root Boolean value. Enable this flag if you set the root project as the modules-directory to optimize performance r8-mapping-file Path to the R8 mapping file if you enable R8 for your build owner-mapping-file Path to YAML file mapping project modules to team owners version Your app version large-file-threshold File size threshold (in bytes) for considering a file as large project-name Project name
"},{"location":"cli/#apk-generation","title":"APK Generation","text":"Property Description bundle-tool Path to the bundletool JAR file app-bundle-file Path to the app bundle file (aab) device-specs List of device specification files for APK generation key-signing Key signing information"},{"location":"cli/#output-configuration","title":"Output Configuration","text":"Property Description output-directory Directory to save markdown and JSON reports custom-attributes Map of additional attributes to include in every report row influx-db-config InfluxDB configuration (see below)"},{"location":"cli/#influxdb-configuration","title":"InfluxDB Configuration","text":"Property Description url URL of the InfluxDB server db-name Name of the InfluxDB database report-table-name Measurement name for storing report data username InfluxDB username (optional) password InfluxDB password (optional) retention-policy InfluxDB retention policy configuration (optional)"},{"location":"cli/#full-configuration-example","title":"Full Configuration Example","text":"
App Sizer is a powerful tool, but it has some limitations that users should be aware of. This document outlines the key limitations and explains their impact on the analysis results.
Calculating the exact download size of a class from an APK is challenging. App Sizer uses an approximation method:
We obtain a relative size of the class definition (termed 'raw size').
We use the Dex file download size that the class belongs to.
We derive a relative value for the class's download size using the formula:
class's download size = class raw size * (dex download size / all classes' raw size)\n
This approach provides a reasonable estimation but may not be 100% accurate. Interestingly, similar tools in the community have independently developed comparable methods.
"},{"location":"limitation/#files-grouped-under-others","title":"Files Grouped Under \"Others\"","text":""},{"location":"limitation/#resourcesarsc-file","title":"resources.arsc File","text":"
The resources.arsc file is a special file in Android APKs containing precompiled resources (such as binary XML for strings, arrays, and other value types) in a binary format for efficient access.
App Sizer does not analyze this file individually.
It's grouped under the \"Others\" category.
For small Android projects, this can disproportionately impact the data, potentially creating the illusion of an inefficient analysis.
Any files that cannot be categorized as Java/Kotlin code, resources, native libraries, or assets are automatically distributed to the app module and grouped under the \"Others\" category.
Any files/classes that cannot find an owner (does not belong to a module or library) are automatically distributed to the app module
"},{"location":"limitation/#inline-functions-and-classes","title":"Inline Functions and Classes","text":"
The nature of inline functions and inline value classes in Kotlin presents a unique challenge:
The size contributed by inline elements is calculated and distributed to where they are used, not where the inline methods/classes are created.
Build systems or optimization tools like R8 might rewrite code for efficiency, including inlining methods, which can result in similar outcomes to inline functions.
This behavior can make it difficult to accurately attribute size contributions to specific modules or libraries.
"},{"location":"limitation/#impact-on-analysis","title":"Impact on Analysis","text":"
These limitations mean that App Sizer's results should be interpreted as close approximations rather than exact measurements. They are most useful for:
Identifying trends in app size growth
Comparing relative size contributions of different components
Spotting large, unexpected size increases
Users should keep these limitations in mind when making decisions based on App Sizer's output, especially for small projects or when dealing with inline-heavy codebases.
Use the registered appSizer extension block to the app module's build.gradle to configure App Sizer Plugin
appSizer {\n enabled = true\n projectInput {\n // config the input for the plugin\n }\n metrics {\n // config the output for the plugin\n }\n}\n
* enabled: Given the App Sizer Plugin has not supported configuration on demand & configuration catching. We provide you an option to turned of the plugin just in case it impact your gradle configuration performance."},{"location":"plugin/#project-input","title":"Project Input","text":"
Property Description largeFileThreshold File size threshold (in bytes) for considering a file as large. teamMappingFile YAML file mapping project modules to team owners. enableMatchDebugVariant If true, uses debug AAR files to improve build performance. variantFilter Specifies which variants to exclude from analysis.
Property Description deviceSpecs List of device specification files for APK generation. bundleToolFile Path to the bundletool JAR file."},{"location":"plugin/#output-configuration","title":"Output Configuration","text":"
Property Description local.outputDirectory Directory to save markdown and JSON reports (default is app/build/sizer/reports) customAttributes Map of additional attributes to include in every report row. Such as pipeline-id, etc"},{"location":"plugin/#influxdb-configuration","title":"InfluxDB Configuration","text":"Property Description dbName Name of the InfluxDB database. reportTableName Measurement name for storing report data. url URL of the InfluxDB server. username InfluxDB username (optional). password InfluxDB password (optional). retentionPolicy InfluxDB retention policy configuration (optional)."},{"location":"plugin/#full-configuration-example","title":"Full Configuration Example","text":"
If you encounter issues with the verifyResourceRelease task, try these solutions: - Check that your resource files are properly formatted and located - Verify that resource names follow Android naming conventions - Enable the enableMatchDebugVariant flag in your configuration
A default App Download Size Breakdown dashboard is included in the Grafana docker instance. If you have an existing InfluxDB and Grafana setup, you can import our dashboard using this JSON file. Our blogpost introduce the provided dashboards
Markdown tables provide a convenient format for local analysis. The report is saved as [option]-report.md in the configured output folder (default: app/build/sizer/reports).
Each object in the array represents a single database row and contains the following properties:
name: The measurement name (e.g., \"apk\")
fields: An array of fields containing numerical or custom data
tags: Each measurement includes relevant tags such as the project name, app version, build type, and device name, allowing for detailed analysis and filtering of the data.
timestamp: Unix timestamp (in milliseconds) when the measurement was taken
"},{"location":"report/#using-the-json-report","title":"Using the JSON Report","text":"
The JSON format makes it easy to:
Import the data into various tools/databases
Integrate with other CI/CD processes
Perform programmatic analysis of app size trends over time
You can parse this JSON data using any standard JSON library in your preferred programming language to extract and analyze the information as needed for your project.
You can customize the reports by modifying the configuration in your Gradle plugin or CLI tool setup. For more details, refer to the Plugin Configuration or CLI Configuration guides.