From f0a37d81f088c45b7e90ba381636db35aa24a8d8 Mon Sep 17 00:00:00 2001 From: akshay-grabtaxi Date: Mon, 23 Dec 2024 02:53:07 +0000 Subject: [PATCH] Deployed 812146c with MkDocs version: 1.6.1 --- index.html | 2 +- plugin/index.html | 10 +++++----- search/search_index.json | 2 +- sitemap.xml | 14 +++++++------- sitemap.xml.gz | Bin 241 -> 241 bytes 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index 184fa1a..bf6ab07 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - App Sizer
Skip to content

App Sizer

Overview

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

Key Features

App Sizer offers comprehensive analysis including:

  1. Total app download size
  2. Detailed size breakdown
  3. Size contribution by teams
  4. Module-wise size contribution
  5. Size contribution by libraries
  6. List of large files

Reports are generated based on the provided Android device specifications. Our blogpost introduce the tool features

Quick Start

App Sizer provides two flexible integration methods:

Note: The command-line option was the original implementation and remains supported for broader compatibility.

Report Types

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

How it works

App Sizer functions as a mapping tool to generate the report. It takes APK, AAR, and JAR files as inputs.

  1. 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.
  2. 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.

Limitations

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.

Components

Contributing

If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the App Sizer repository.

License

MIT License
+ App Sizer      

App Sizer

Overview

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

Key Features

App Sizer offers comprehensive analysis including:

  1. Total app download size
  2. Detailed size breakdown
  3. Size contribution by teams
  4. Module-wise size contribution
  5. Size contribution by libraries
  6. List of large files

Reports are generated based on the provided Android device specifications. Our blogpost introduce the tool features

Integration

App Sizer provides two flexible integration methods:

Note: The command-line option was the original implementation and remains supported for broader compatibility.

Report types

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

How it works

App Sizer functions as a mapping tool to generate the report. It takes APK, AAR, and JAR files as inputs.

  1. 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.
  2. 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.

Limitations

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.

Components

Contributing

If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the App Sizer repository.

License

MIT License
 
 
 Copyright 2024 Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
diff --git a/plugin/index.html b/plugin/index.html
index 2259105..bfb61c0 100644
--- a/plugin/index.html
+++ b/plugin/index.html
@@ -1,19 +1,19 @@
- Gradle Plugin - App Sizer      

App Sizer Plugin

App Sizer provide a gradle plugin as the option to seamlessly integrates with your Android Gradle project. This option is recommended.

Getting Started

There are two ways to integrate the App Sizer plugin into your project:

  1. Add the mavenCentral to your root settings.gradle:

pluginManagement {
+ Gradle Plugin - App Sizer      

App Sizer Plugin

App Sizer provide a gradle plugin as the option to seamlessly integrates with your Android Gradle project. This option is recommended.

Getting Started

There are two ways to integrate the App Sizer plugin into your project:

  1. Add the mavenCentral to your root settings.gradle:
    pluginManagement {
         repositories {
             mavenCentral()
         }
     }
    -
    2. Add the plugin to your project classpath (root's build.gradle):
    plugins {
    +
  2. Add the plugin to your project classpath (root's build.gradle):
    plugins {
         id "com.grab.sizer" version "0.1.0-alpha01" apply false
     }
    -

    1. Apply and configure the plugin to your app module's build.gradle:
    plugins {
    +
  3. Apply and configure the plugin to your app module's build.gradle:
plugins {
     id "com.grab.sizer" version "0.1.0-alpha01"
 }
 
 appSizer {
     // Configuration goes here
 }
-

Option 2: Legacy buildscript method

  1. Add the plugin to your root build.gradle
buildscript {
+

Option 2: Legacy buildscript method

  1. Add the plugin to your root build.gradle
    buildscript {
         repositories {
             mavenCentral()
         }
    @@ -21,7 +21,7 @@
             classpath "com.grab.sizer:sizer-gradle-plugin:0.1.0-alpha01"
         }
     }
    -
    1. Apply the plugin in your app module's build.gradle
    apply plugin: "com.grab.sizer"
    +
  2. Apply the plugin in your app module's build.gradle
apply plugin: "com.grab.sizer"
 
 appSizer {
     // Configuration goes here
diff --git a/search/search_index.json b/search/search_index.json
index 26af55b..34b9d0c 100644
--- a/search/search_index.json
+++ b/search/search_index.json
@@ -1 +1 @@
-{"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

"},{"location":"#key-features","title":"Key Features","text":"

App Sizer offers comprehensive analysis including:

  1. Total app download size
  2. Detailed size breakdown
  3. Size contribution by teams
  4. Module-wise size contribution
  5. Size contribution by libraries
  6. List of large files

Reports are generated based on the provided Android device specifications. Our blogpost introduce the tool features

"},{"location":"#quick-start","title":"Quick Start","text":"

App Sizer provides two flexible integration methods:

  • A Gradle plugin that seamlessly integrates with your Android Gradle project (Plugin Configuration Detail.)
  • A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features (Commandline Configuration Detail.)

Note: The command-line option was the original implementation and remains supported for broader compatibility.

"},{"location":"#report-types","title":"Report Types","text":"

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.

  1. 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.
  2. 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.
"},{"location":"#limitations","title":"Limitations","text":"

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.

"},{"location":"#components","title":"Components","text":"
  • Gradle Plugin
  • Command line tool
  • InfluxDb & Grafana Docker
"},{"location":"#contributing","title":"Contributing","text":"

If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the App Sizer repository.

"},{"location":"#license","title":"License","text":"
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
"},{"location":"cli/","title":"App Sizer CLI","text":"

App Sizer provides a Command Line Interface (CLI) to cater to non-Gradle build systems, offering the same comprehensive features as the Gradle plugin.

"},{"location":"cli/#getting-started","title":"Getting Started","text":"
  1. Download our Latest Release from GitHub (support Java 11+)

  2. Create your config file following this template.

  3. Run the analysis using the command line tool:

    java -jar cli-all.jar --config-file ./path/to/config/your-config-file.yml\n

Note, by any reason the download Jar does not work. You could check out the repo and generate the command line binary file

./gradlew cli:shadowJar\n

"},{"location":"cli/#configuration","title":"Configuration","text":"

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

And example of owner-mapping-file:

Platform:\n  - app\nTeam1:\n  - android-module-level1\n  - kotlin-module\nTeam2:\n  - sample-group:android-module-level2\n
"},{"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":"
project-input:\n  libraries-directory: \"./build/gradle-cache/caches/modules-2/files-2.1\"\n  modules-directory: \"./\"\n  modules-dir-is-project-root: true\n  r8-mapping-file: \"./app/build/outputs/mapping/proDebug/mapping.txt\"\n  owner-mapping-file: \"./module-owner.yml\"\n  version: \"1.0.1\"\n  large-file-threshold: 10\n  project-name: \"sample\"\napk-generation:\n  bundle-tool: \"./binary/bundletool-all-1.15.4.jar\"\n  app-bundle-file: \"./app/build/outputs/bundle/proDebug/sample-bundle-file-pro-debug.aab\"\n  device-specs:\n    - \"./app-size-config/device-1.json\"\n    - \"./app-size-config/device-2.json\"\n  key-signing:\n    keystore-file: \"./buildsystem/sample-release.keystore\"\n    keystore-pw: \"12345678\"\n    key-alias: \"key0\"\n    key-pw: \"12345678\"\nreport:\n  output-directory: \"./build/app-sizer\"\n  custom-attributes:\n    pipelineId: \"100\"\n  influx-db-config:\n    db-name: \"sizer\"\n    url: \"http://localhost:8086\"\n    username: \"root\"\n    password: \"root\"\n    report-table-name: \"app_size\"\n    retention-policy:\n      name: \"app_sizer\"\n      duration: \"360d\"\n      shard-duration: \"0m\"\n      replication-factor: 2\n      is-default: true\n
"},{"location":"cli/#resources","title":"Resources","text":"
  • Bundletool GitHub Repository
  • InfluxDB Documentation
"},{"location":"docker/","title":"Sizer-influx-grafana","text":"

This is a Docker image based on the awesome docker-influxdb-grafana from Phil Hawthorne.

"},{"location":"docker/#key-different","title":"Key Different","text":"
  • Newer Grafana version
  • Added provisioned app-sizer Dashboard and Datasources
  • ChronoGraf is not included in this container

The main purpose of this image is to be used to demo data from App Sizer.

Component Version InfluxDB 1.8.2 Grafana 9.0.0"},{"location":"docker/#pre-configured-dashboard","title":"Pre-configured Dashboard","text":"

The Docker image includes a pre-configured dashboard in Grafana:

To use the dashboard, you either to:

  1. Default Configuration: Uses database name sizer and measurement (table) named app_size. (They are default values configured in the App Sizer tool)
  2. Custom Configuration:
  3. For a different database name: Update the Grafana Data Sources named InfluxDB.
  4. For a different measurement name: Update all queries and variables in the dashboard.

To import the dashboard into an existing setup:

  1. Use this JSON file.
  2. Ensure you add the proper Grafana datasource.
  3. Update the measurement (table) name in the queries and variables if necessary
"},{"location":"docker/#quick-start","title":"Quick Start","text":"

To start the container with persistence, you can use our teammate's docker image exported to Docker Hub:

docker run -d \\\n  --name sizer-influxdb-grafana \\\n  -p 3003:3003 \\\n  -p 8086:8086 \\\n  -v /path/for/influxdb:/var/lib/influxdb \\\n  -v /path/for/grafana:/var/lib/grafana \\\n  mikenguyen/sizer-influx-grafana:latest\n
"},{"location":"docker/#mapped-ports","title":"Mapped Ports","text":"Host Container Service 3003 3003 Grafana 8086 8086 InfluxDB"},{"location":"docker/#accessing-services","title":"Accessing Services","text":""},{"location":"docker/#grafana","title":"Grafana","text":"
  • URL: http://localhost:3003
  • Default Username: root
  • Default Password: root
"},{"location":"docker/#influxdb","title":"InfluxDB","text":"
  • Port: 8086
  • Default Username: root
  • Default Password: root
"},{"location":"limitation/","title":"Limitations","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.

"},{"location":"limitation/#class-download-size-calculation","title":"Class Download Size Calculation","text":"

Calculating the exact download size of a class from an APK is challenging. App Sizer uses an approximation method:

  1. We obtain a relative size of the class definition (termed 'raw size').
  2. We use the Dex file download size that the class belongs to.
  3. 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.
"},{"location":"limitation/#uncategorized-files","title":"Uncategorized Files","text":"
  • 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.

"},{"location":"plugin/","title":"App Sizer Plugin","text":"

App Sizer provide a gradle plugin as the option to seamlessly integrates with your Android Gradle project. This option is recommended.

"},{"location":"plugin/#getting-started","title":"Getting Started","text":"

There are two ways to integrate the App Sizer plugin into your project:

"},{"location":"plugin/#option-1-plugins-dsl-recommended","title":"Option 1: Plugins DSL (Recommended)","text":"
  1. Add the mavenCentral to your root settings.gradle:

pluginManagement {\n    repositories {\n        mavenCentral()\n    }\n}\n
2. Add the plugin to your project classpath (root's build.gradle):
plugins {\n    id \"com.grab.sizer\" version \"0.1.0-alpha01\" apply false\n}\n

  1. Apply and configure the plugin to your app module's build.gradle:
plugins {\n    id \"com.grab.sizer\" version \"0.1.0-alpha01\"\n}\n\nappSizer {\n    // Configuration goes here\n}\n
"},{"location":"plugin/#option-2-legacy-buildscript-method","title":"Option 2: Legacy buildscript method","text":"
  1. Add the plugin to your root build.gradle
buildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath \"com.grab.sizer:sizer-gradle-plugin:0.1.0-alpha01\"\n    }\n}\n
  1. Apply the plugin in your app module's build.gradle
apply plugin: \"com.grab.sizer\"\n\nappSizer {\n    // Configuration goes here\n}\n
"},{"location":"plugin/#run-the-analysis","title":"Run the analysis","text":"
./gradlew app:appSizeAnalysis[Release|Debug] --no-configure-on-demand --no-configuration-cache\n
"},{"location":"plugin/#configuration","title":"Configuration","text":"

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":"

Configure the input for the project:

appSizer {\n    projectInput {\n        largeFileThreshold = [your_threshold_in_bytes]\n        teamMappingFile = file(\"path/to/your/module-owner.yml\")\n        enableMatchDebugVariant = [true|false]\n        variantFilter { variant ->\n            variant.setIgnore(variant.flavors.contains(\"your-ignore-flavor\"))\n        }\n        apk {\n            // APK Generation\n        }\n    }\n    ...\n}\n
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.

And example of teamMappingFile:

Platform:\n  - app\nTeam1:\n  - android-module-level1\n  - kotlin-module\nTeam2:\n  - sample-group:android-module-level2\n
"},{"location":"plugin/#apk-generation","title":"APK Generation","text":"

Configure APK generation settings:

appSizer {\n    projectInput {\n        ...\n        apk {\n            deviceSpecs = [\n                file(\"path/to/device-1.json\"),\n                file(\"path/to/device-2.json\"),\n            ]\n            bundleToolFile = file(\"path/to/bundletool.jar\")\n        }\n    }\n    ...\n}\n
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":"

Configure the reporting output:

appSizer {\n    ...\n    metrics {\n        influxDB {\n            dbName = \"[your-database-name]\"\n            reportTableName = \"[your-table-name]\"\n            url = \"[url-to-your-influxdb]\"\n            username = \"[your-database-username]\"\n            password = \"[your-database-password]\"\n        }\n        local {\n            outputDirectory = [your-output-directory] // Such as project.layout.buildDirectory.dir(\"app-sizer\")\n        }\n        customAttributes.putAll(\n            [\"your-custom-attribute-key\": \"your-custom-attribute-value\"]\n        )\n    }\n}\n
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":"
appSizer {\n    enabled = true\n    projectInput {\n        apk {\n            bundleToolFile = file(\"${rootProject.rootDir}/binary/bundletool-all-1.15.4.jar\")\n            deviceSpecs = [\n                file(\"${rootProject.rootDir}/app-size-config/device-1.json\"),\n                file(\"${rootProject.rootDir}/app-size-config/device-2.json\")\n            ]\n        }\n        variantFilter { variant ->\n            variant.setIgnore(variant.flavors.contains(\"gea\"))\n        }\n        enableMatchDebugVariant = true\n        largeFileThreshold = 10\n        teamMappingFile = file(\"${rootProject.rootDir}/module-owner.yml\")\n    }\n    metrics {\n        influxDB {\n            dbName = \"sizer\"\n            reportTableName = \"app_size\"\n            url = \"http://localhost:8086\"\n            username = \"root\"\n            password = \"root\"\n            retentionPolicy {\n                name = \"app_sizer\"\n                duration = \"360d\"\n                shardDuration = \"0m\"\n                replicationFactor = 2\n                setAsDefault = true\n            }\n        }\n        local {\n            outputDirectory = project.layout.buildDirectory.dir(\"app-sizer\")\n        }\n        customAttributes.putAll(\n            [\"pipeline_id\": \"1001\"]\n        )\n    }\n}\n
"},{"location":"plugin/#task-graph","title":"Task Graph","text":""},{"location":"plugin/#troubleshooting","title":"Troubleshooting","text":""},{"location":"plugin/#resource-verification-failures","title":"Resource Verification Failures","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

"},{"location":"plugin/#dagger-nosuchmethoderror","title":"Dagger NoSuchMethodError","text":"

If you encounter this exception:

NoSuchMethodError: 'java.lang.Object dagger.internal.Preconditions.checkNotNullFromProvides'\n
This error typically occurs due to a version conflict between the Android build tools and the App-Sizer plugin's Dagger dependencies. To resolve:

  1. Ensure the App-Sizer plugin is added to the classpath in the root build.gradle before applying it to your app module
  2. If step 1 doesn't resolve the issue, you might have to resolve the Dagger version conflict by adding this to your classpath
    classpath \"com.google.dagger:dagger:2.47\"\n
"},{"location":"plugin/#resources","title":"Resources","text":"
  • Bundletool GitHub Repository
  • InfluxDB Documentation
"},{"location":"report/","title":"Reports","text":"

App Sizer supports three types of reports to cater to different use cases and environments:

  1. InfluxDB database (1.x)
  2. Markdown tables
  3. JSON data
"},{"location":"report/#influxdb-database","title":"InfluxDB Database","text":""},{"location":"report/#setup","title":"Setup","text":"

We provide a Docker image with InfluxDB (1.x) and Grafana pre-configured to showcase the dashboards:

docker run -d \\\n  --name sizer-influxdb-grafana \\\n  -p 3003:3003 \\\n  -p 3004:8083 \\\n  -p 8086:8086 \\\n  -v /path/for/influxdb:/var/lib/influxdb \\\n  -v /path/for/grafana:/var/lib/grafana \\\n  mikenguyen/sizer-influx-grafana:latest\n

For more details on the Docker setup, see our Docker guide.

"},{"location":"report/#grafana-dashboard","title":"Grafana Dashboard","text":"

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

"},{"location":"report/#markdown-tables","title":"Markdown Tables","text":"

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).

"},{"location":"report/#example-module-wise-size-contribution","title":"Example: Module-wise Size Contribution","text":"Contributor Owner Size app Platform 90.078 KB android-module-level2 Team2 123.968 KB android-module-level1 Team1 124.042 KB kotlin-module Team2 248.326 KB"},{"location":"report/#json-report","title":"JSON Report","text":"

JSON reports offer compatibility with other platforms and tools. The report is saved as [option]-metrics.json in the configured output folder.

"},{"location":"report/#json-structure","title":"JSON Structure","text":"

Here's a sample of the JSON structure:

[\n  {\n    \"name\": \"apk\",\n    \"fields\": [\n      {\n        \"name\": \"size\",\n        \"value\": \"1789199\",\n        \"value_type\": \"integer\"\n      },\n      {\n        \"name\": \"pipeline_id\",\n        \"value\": \"1001\",\n        \"value_type\": \"string\"\n      }\n    ],\n    \"tags\": [\n      {\n        \"name\": \"contributor\",\n        \"value\": \"apk\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"project\",\n        \"value\": \"sample\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"app_version\",\n        \"value\": \"1.0.9\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"build_type\",\n        \"value\": \"proDebug\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"device_name\",\n        \"value\": \"device-1\",\n        \"value_type\": \"string\"\n      }\n    ],\n    \"timestamp\": 1720248703061\n  },\n  // More measurements...\n]\n
"},{"location":"report/#json-fields-explanation","title":"JSON Fields Explanation","text":"

Each object in the array represents a single database row and contains the following properties:

  1. name: The measurement name (e.g., \"apk\")
  2. fields: An array of fields containing numerical or custom data
  3. 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.
  4. 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:

  1. Import the data into various tools/databases
  2. Integrate with other CI/CD processes
  3. 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.

"},{"location":"report/#customizing-reports","title":"Customizing Reports","text":"

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.

"},{"location":"task_graph/","title":"Task graph","text":"
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

"},{"location":"#key-features","title":"Key Features","text":"

App Sizer offers comprehensive analysis including:

  1. Total app download size
  2. Detailed size breakdown
  3. Size contribution by teams
  4. Module-wise size contribution
  5. Size contribution by libraries
  6. List of large files

Reports are generated based on the provided Android device specifications. Our blogpost introduce the tool features

"},{"location":"#integration","title":"Integration","text":"

App Sizer provides two flexible integration methods:

  • A Gradle plugin that seamlessly integrates with your Android Gradle project (Plugin Configuration Detail.)
  • A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features (Commandline Configuration Detail.)

Note: The command-line option was the original implementation and remains supported for broader compatibility.

"},{"location":"#report-types","title":"Report types","text":"

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.

  1. 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.
  2. 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.
"},{"location":"#limitations","title":"Limitations","text":"

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.

"},{"location":"#components","title":"Components","text":"
  • Gradle Plugin
  • Command line tool
  • InfluxDb & Grafana Docker
"},{"location":"#contributing","title":"Contributing","text":"

If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the App Sizer repository.

"},{"location":"#license","title":"License","text":"
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
"},{"location":"cli/","title":"App Sizer CLI","text":"

App Sizer provides a Command Line Interface (CLI) to cater to non-Gradle build systems, offering the same comprehensive features as the Gradle plugin.

"},{"location":"cli/#getting-started","title":"Getting Started","text":"
  1. Download our Latest Release from GitHub (support Java 11+)

  2. Create your config file following this template.

  3. Run the analysis using the command line tool:

    java -jar cli-all.jar --config-file ./path/to/config/your-config-file.yml\n

Note, by any reason the download Jar does not work. You could check out the repo and generate the command line binary file

./gradlew cli:shadowJar\n

"},{"location":"cli/#configuration","title":"Configuration","text":"

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

And example of owner-mapping-file:

Platform:\n  - app\nTeam1:\n  - android-module-level1\n  - kotlin-module\nTeam2:\n  - sample-group:android-module-level2\n
"},{"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":"
project-input:\n  libraries-directory: \"./build/gradle-cache/caches/modules-2/files-2.1\"\n  modules-directory: \"./\"\n  modules-dir-is-project-root: true\n  r8-mapping-file: \"./app/build/outputs/mapping/proDebug/mapping.txt\"\n  owner-mapping-file: \"./module-owner.yml\"\n  version: \"1.0.1\"\n  large-file-threshold: 10\n  project-name: \"sample\"\napk-generation:\n  bundle-tool: \"./binary/bundletool-all-1.15.4.jar\"\n  app-bundle-file: \"./app/build/outputs/bundle/proDebug/sample-bundle-file-pro-debug.aab\"\n  device-specs:\n    - \"./app-size-config/device-1.json\"\n    - \"./app-size-config/device-2.json\"\n  key-signing:\n    keystore-file: \"./buildsystem/sample-release.keystore\"\n    keystore-pw: \"12345678\"\n    key-alias: \"key0\"\n    key-pw: \"12345678\"\nreport:\n  output-directory: \"./build/app-sizer\"\n  custom-attributes:\n    pipelineId: \"100\"\n  influx-db-config:\n    db-name: \"sizer\"\n    url: \"http://localhost:8086\"\n    username: \"root\"\n    password: \"root\"\n    report-table-name: \"app_size\"\n    retention-policy:\n      name: \"app_sizer\"\n      duration: \"360d\"\n      shard-duration: \"0m\"\n      replication-factor: 2\n      is-default: true\n
"},{"location":"cli/#resources","title":"Resources","text":"
  • Bundletool GitHub Repository
  • InfluxDB Documentation
"},{"location":"docker/","title":"Sizer-influx-grafana","text":"

This is a Docker image based on the awesome docker-influxdb-grafana from Phil Hawthorne.

"},{"location":"docker/#key-different","title":"Key Different","text":"
  • Newer Grafana version
  • Added provisioned app-sizer Dashboard and Datasources
  • ChronoGraf is not included in this container

The main purpose of this image is to be used to demo data from App Sizer.

Component Version InfluxDB 1.8.2 Grafana 9.0.0"},{"location":"docker/#pre-configured-dashboard","title":"Pre-configured Dashboard","text":"

The Docker image includes a pre-configured dashboard in Grafana:

To use the dashboard, you either to:

  1. Default Configuration: Uses database name sizer and measurement (table) named app_size. (They are default values configured in the App Sizer tool)
  2. Custom Configuration:
  3. For a different database name: Update the Grafana Data Sources named InfluxDB.
  4. For a different measurement name: Update all queries and variables in the dashboard.

To import the dashboard into an existing setup:

  1. Use this JSON file.
  2. Ensure you add the proper Grafana datasource.
  3. Update the measurement (table) name in the queries and variables if necessary
"},{"location":"docker/#quick-start","title":"Quick Start","text":"

To start the container with persistence, you can use our teammate's docker image exported to Docker Hub:

docker run -d \\\n  --name sizer-influxdb-grafana \\\n  -p 3003:3003 \\\n  -p 8086:8086 \\\n  -v /path/for/influxdb:/var/lib/influxdb \\\n  -v /path/for/grafana:/var/lib/grafana \\\n  mikenguyen/sizer-influx-grafana:latest\n
"},{"location":"docker/#mapped-ports","title":"Mapped Ports","text":"Host Container Service 3003 3003 Grafana 8086 8086 InfluxDB"},{"location":"docker/#accessing-services","title":"Accessing Services","text":""},{"location":"docker/#grafana","title":"Grafana","text":"
  • URL: http://localhost:3003
  • Default Username: root
  • Default Password: root
"},{"location":"docker/#influxdb","title":"InfluxDB","text":"
  • Port: 8086
  • Default Username: root
  • Default Password: root
"},{"location":"limitation/","title":"Limitations","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.

"},{"location":"limitation/#class-download-size-calculation","title":"Class Download Size Calculation","text":"

Calculating the exact download size of a class from an APK is challenging. App Sizer uses an approximation method:

  1. We obtain a relative size of the class definition (termed 'raw size').
  2. We use the Dex file download size that the class belongs to.
  3. 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.
"},{"location":"limitation/#uncategorized-files","title":"Uncategorized Files","text":"
  • 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.

"},{"location":"plugin/","title":"App Sizer Plugin","text":"

App Sizer provide a gradle plugin as the option to seamlessly integrates with your Android Gradle project. This option is recommended.

"},{"location":"plugin/#getting-started","title":"Getting Started","text":"

There are two ways to integrate the App Sizer plugin into your project:

"},{"location":"plugin/#option-1-plugins-dsl-recommended","title":"Option 1: Plugins DSL (Recommended)","text":"
  1. Add the mavenCentral to your root settings.gradle:
    pluginManagement {\n    repositories {\n        mavenCentral()\n    }\n}\n
  2. Add the plugin to your project classpath (root's build.gradle):
    plugins {\n    id \"com.grab.sizer\" version \"0.1.0-alpha01\" apply false\n}\n
  3. Apply and configure the plugin to your app module's build.gradle:
plugins {\n    id \"com.grab.sizer\" version \"0.1.0-alpha01\"\n}\n\nappSizer {\n    // Configuration goes here\n}\n
"},{"location":"plugin/#option-2-legacy-buildscript-method","title":"Option 2: Legacy buildscript method","text":"
  1. Add the plugin to your root build.gradle
    buildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath \"com.grab.sizer:sizer-gradle-plugin:0.1.0-alpha01\"\n    }\n}\n
  2. Apply the plugin in your app module's build.gradle
apply plugin: \"com.grab.sizer\"\n\nappSizer {\n    // Configuration goes here\n}\n
"},{"location":"plugin/#run-the-analysis","title":"Run the analysis","text":"
./gradlew app:appSizeAnalysis[Release|Debug] --no-configure-on-demand --no-configuration-cache\n
"},{"location":"plugin/#configuration","title":"Configuration","text":"

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":"

Configure the input for the project:

appSizer {\n    projectInput {\n        largeFileThreshold = [your_threshold_in_bytes]\n        teamMappingFile = file(\"path/to/your/module-owner.yml\")\n        enableMatchDebugVariant = [true|false]\n        variantFilter { variant ->\n            variant.setIgnore(variant.flavors.contains(\"your-ignore-flavor\"))\n        }\n        apk {\n            // APK Generation\n        }\n    }\n    ...\n}\n
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.

And example of teamMappingFile:

Platform:\n  - app\nTeam1:\n  - android-module-level1\n  - kotlin-module\nTeam2:\n  - sample-group:android-module-level2\n
"},{"location":"plugin/#apk-generation","title":"APK Generation","text":"

Configure APK generation settings:

appSizer {\n    projectInput {\n        ...\n        apk {\n            deviceSpecs = [\n                file(\"path/to/device-1.json\"),\n                file(\"path/to/device-2.json\"),\n            ]\n            bundleToolFile = file(\"path/to/bundletool.jar\")\n        }\n    }\n    ...\n}\n
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":"

Configure the reporting output:

appSizer {\n    ...\n    metrics {\n        influxDB {\n            dbName = \"[your-database-name]\"\n            reportTableName = \"[your-table-name]\"\n            url = \"[url-to-your-influxdb]\"\n            username = \"[your-database-username]\"\n            password = \"[your-database-password]\"\n        }\n        local {\n            outputDirectory = [your-output-directory] // Such as project.layout.buildDirectory.dir(\"app-sizer\")\n        }\n        customAttributes.putAll(\n            [\"your-custom-attribute-key\": \"your-custom-attribute-value\"]\n        )\n    }\n}\n
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":"
appSizer {\n    enabled = true\n    projectInput {\n        apk {\n            bundleToolFile = file(\"${rootProject.rootDir}/binary/bundletool-all-1.15.4.jar\")\n            deviceSpecs = [\n                file(\"${rootProject.rootDir}/app-size-config/device-1.json\"),\n                file(\"${rootProject.rootDir}/app-size-config/device-2.json\")\n            ]\n        }\n        variantFilter { variant ->\n            variant.setIgnore(variant.flavors.contains(\"gea\"))\n        }\n        enableMatchDebugVariant = true\n        largeFileThreshold = 10\n        teamMappingFile = file(\"${rootProject.rootDir}/module-owner.yml\")\n    }\n    metrics {\n        influxDB {\n            dbName = \"sizer\"\n            reportTableName = \"app_size\"\n            url = \"http://localhost:8086\"\n            username = \"root\"\n            password = \"root\"\n            retentionPolicy {\n                name = \"app_sizer\"\n                duration = \"360d\"\n                shardDuration = \"0m\"\n                replicationFactor = 2\n                setAsDefault = true\n            }\n        }\n        local {\n            outputDirectory = project.layout.buildDirectory.dir(\"app-sizer\")\n        }\n        customAttributes.putAll(\n            [\"pipeline_id\": \"1001\"]\n        )\n    }\n}\n
"},{"location":"plugin/#task-graph","title":"Task Graph","text":""},{"location":"plugin/#troubleshooting","title":"Troubleshooting","text":""},{"location":"plugin/#resource-verification-failures","title":"Resource Verification Failures","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

"},{"location":"plugin/#dagger-nosuchmethoderror","title":"Dagger NoSuchMethodError","text":"

If you encounter this exception:

NoSuchMethodError: 'java.lang.Object dagger.internal.Preconditions.checkNotNullFromProvides'\n
This error typically occurs due to a version conflict between the Android build tools and the App-Sizer plugin's Dagger dependencies. To resolve:

  1. Ensure the App-Sizer plugin is added to the classpath in the root build.gradle before applying it to your app module
  2. If step 1 doesn't resolve the issue, you might have to resolve the Dagger version conflict by adding this to your classpath
    classpath \"com.google.dagger:dagger:2.47\"\n
"},{"location":"plugin/#resources","title":"Resources","text":"
  • Bundletool GitHub Repository
  • InfluxDB Documentation
"},{"location":"report/","title":"Reports","text":"

App Sizer supports three types of reports to cater to different use cases and environments:

  1. InfluxDB database (1.x)
  2. Markdown tables
  3. JSON data
"},{"location":"report/#influxdb-database","title":"InfluxDB Database","text":""},{"location":"report/#setup","title":"Setup","text":"

We provide a Docker image with InfluxDB (1.x) and Grafana pre-configured to showcase the dashboards:

docker run -d \\\n  --name sizer-influxdb-grafana \\\n  -p 3003:3003 \\\n  -p 3004:8083 \\\n  -p 8086:8086 \\\n  -v /path/for/influxdb:/var/lib/influxdb \\\n  -v /path/for/grafana:/var/lib/grafana \\\n  mikenguyen/sizer-influx-grafana:latest\n

For more details on the Docker setup, see our Docker guide.

"},{"location":"report/#grafana-dashboard","title":"Grafana Dashboard","text":"

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

"},{"location":"report/#markdown-tables","title":"Markdown Tables","text":"

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).

"},{"location":"report/#example-module-wise-size-contribution","title":"Example: Module-wise Size Contribution","text":"Contributor Owner Size app Platform 90.078 KB android-module-level2 Team2 123.968 KB android-module-level1 Team1 124.042 KB kotlin-module Team2 248.326 KB"},{"location":"report/#json-report","title":"JSON Report","text":"

JSON reports offer compatibility with other platforms and tools. The report is saved as [option]-metrics.json in the configured output folder.

"},{"location":"report/#json-structure","title":"JSON Structure","text":"

Here's a sample of the JSON structure:

[\n  {\n    \"name\": \"apk\",\n    \"fields\": [\n      {\n        \"name\": \"size\",\n        \"value\": \"1789199\",\n        \"value_type\": \"integer\"\n      },\n      {\n        \"name\": \"pipeline_id\",\n        \"value\": \"1001\",\n        \"value_type\": \"string\"\n      }\n    ],\n    \"tags\": [\n      {\n        \"name\": \"contributor\",\n        \"value\": \"apk\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"project\",\n        \"value\": \"sample\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"app_version\",\n        \"value\": \"1.0.9\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"build_type\",\n        \"value\": \"proDebug\",\n        \"value_type\": \"string\"\n      },\n      {\n        \"name\": \"device_name\",\n        \"value\": \"device-1\",\n        \"value_type\": \"string\"\n      }\n    ],\n    \"timestamp\": 1720248703061\n  },\n  // More measurements...\n]\n
"},{"location":"report/#json-fields-explanation","title":"JSON Fields Explanation","text":"

Each object in the array represents a single database row and contains the following properties:

  1. name: The measurement name (e.g., \"apk\")
  2. fields: An array of fields containing numerical or custom data
  3. 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.
  4. 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:

  1. Import the data into various tools/databases
  2. Integrate with other CI/CD processes
  3. 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.

"},{"location":"report/#customizing-reports","title":"Customizing Reports","text":"

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.

"},{"location":"task_graph/","title":"Task graph","text":"
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 diff --git a/sitemap.xml b/sitemap.xml index 0e5635d..6083362 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,30 +2,30 @@ https://grab.github.io/app-sizer/ - 2024-12-21 + 2024-12-23 https://grab.github.io/app-sizer/cli/ - 2024-12-21 + 2024-12-23 https://grab.github.io/app-sizer/docker/ - 2024-12-21 + 2024-12-23 https://grab.github.io/app-sizer/limitation/ - 2024-12-21 + 2024-12-23 https://grab.github.io/app-sizer/plugin/ - 2024-12-21 + 2024-12-23 https://grab.github.io/app-sizer/report/ - 2024-12-21 + 2024-12-23 https://grab.github.io/app-sizer/task_graph/ - 2024-12-21 + 2024-12-23 \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 00c008cdd6db38a45d511ab9dc29999625225bf2..24761664b83f2ee1d0308e76c6dea52ef576b01e 100644 GIT binary patch delta 222 zcmV<403rYJ0r3F`ABzYG0H|n@2OWQLI<%Edwmd;QR|F$`3O0y4*HxarIEkvxS-6G! z^WFCoLUhNU$yeVt5r(-Jd)bJ}&L#{vyIy>Loa$F`RJ(3To-9{cJX0@5=J*b1To62((8xETc2$ne;GW&0^TDXig|dxH`YavtxSS;h&@tA8SDQ|tgH85- zOA}9FP;Jw`)cdw>4_Wf)-7)aTd5UN}7N8EnT#8)RX$LHakNQ;{)uCULC(Bh9FEogWIlcpI+a?Lw z&N`9|$pM)u7X*(cH1bWTLzQDUxM#QMeK2Zwp={%lK1+u@t!Ie=bc{9Ok4;X{!!G;3 zrHSV-s;=o?>b9%9HcKA8I|lwZPZ5pB0@N{>OOfk(oRKx>r!N4Hesx#^oNNq<3xHYE Y