{"id":13692925,"url":"https://github.com/twilio/apkscale","last_synced_at":"2025-06-29T13:03:40.086Z","repository":{"id":45537640,"uuid":"278396410","full_name":"twilio/apkscale","owner":"twilio","description":"A Gradle plugin to measure the app size impact of Android libraries","archived":false,"fork":false,"pushed_at":"2024-03-26T00:52:54.000Z","size":160,"stargazers_count":93,"open_issues_count":0,"forks_count":7,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-14T06:13:12.235Z","etag":null,"topics":["android","android-development","android-libraries","android-library","android-sdk","gradle-plugin","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twilio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-07-09T15:05:30.000Z","updated_at":"2025-03-26T08:11:36.000Z","dependencies_parsed_at":"2024-03-31T00:01:32.518Z","dependency_job_id":null,"html_url":"https://github.com/twilio/apkscale","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/twilio/apkscale","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Fapkscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Fapkscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Fapkscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Fapkscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twilio","download_url":"https://codeload.github.com/twilio/apkscale/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Fapkscale/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262598163,"owners_count":23334668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-development","android-libraries","android-library","android-sdk","gradle-plugin","kotlin"],"created_at":"2024-08-02T17:01:03.564Z","updated_at":"2025-06-29T13:03:40.034Z","avatar_url":"https://github.com/twilio.png","language":"Kotlin","funding_links":[],"categories":["Gradle","Kotlin"],"sub_categories":[],"readme":"# apkscale\n\n[![CircleCI](https://circleci.com/gh/twilio/apkscale.svg?style=svg)](https://circleci.com/gh/twilio/apkscale)\n\nA Gradle plugin to measure the app size impact of Android libraries.\n\n![apkscale-logo](images/apkscale-logo.png)\n\n## Requirements\n\n* Android SDK\n* Apkscale can only be applied within a `com.android.library` project.\n* [apkanalyzer](https://developer.android.com/studio/command-line/apkanalyzer) must be in your machine's path\n* Android Gradle Plugin 8.0.0+\n* Java 17\n\n## Usage\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.twilio/apkscale/badge.svg?style=svg)](https://maven-badges.herokuapp.com/maven-central/com.twilio/apkscale)\n\nAdd the following to your project's buildscript section.\n\n```groovy\nbuildscript {\n    repositories {\n        mavenCentral()\n        maven { url 'https://repo.gradle.org/gradle/libs-releases' }\n        // Include this line if you would like to use snapshots\n        maven {\n            url 'https://oss.sonatype.org/content/repositories/snapshots/'\n            mavenContent {\n                snapshotsOnly()\n            }\n        }\n    }\n    // Append -SNAPSHOT for snapshot versions\n    classpath \"com.twilio:apkscale:$apkscaleVersion\"\n}\n```\n\nApply the plugin in your Android library project.\n\n```groovy\napply plugin: 'com.android.library'\napply plugin: 'com.twilio.apkscale'\n\napkscale {\n    // Optional parameter to provide size reports for each ABI in addition to the default universal ABI\n    abis = ['x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a']\n\n    // Optional parameter to specify whether the output is human readable. Defaults to true.\n    humanReadable = true\n}\n```\n\nApkscale adds a `measureSize` task to your Android library module and, when run, scans the output directory of your library and measures the size of each .aar file present. Apkscale outputs the size report to a json file located at `\u003cyourProjectBuildDir\u003e/apkscale/build/outputs/reports/apkscale.json`. The json file contains an array of elements that provide a size report for each .aar file measured. Apkscale writes the size in a `--human-readable` format as specified by [apkanalyzer](https://developer.android.com/studio/command-line/apkanalyzer). Reference the example below.\n\n```json5\n[\n  {\n    \"library\": \"your-library-release.aar\",\n    \"size\": {\n      // Included in all reports\n      \"universal\": \"21.9MB\",\n\n      // Included as specified by the abis parameter\n      \"x86\": \"6MB\",\n      \"x86_64\": \"6.1MB\",\n      \"armeabi-v7a\": \"4.8MB\",\n      \"arm64-v8a\": \"5.7MB\"\n    }\n  }\n]\n```\n\nThe following demonstrates how to read the Apkscale output and convert it to a markdown table.\n\n```groovy\ntask generateSizeReport {\n    dependsOn('measureSize')\n\n    doLast {\n        def sizeReport = \"Size Report\\n\" +\n                \"\\n\" +\n                \"| ABI             | APK Size Impact |\\n\" +\n                \"| --------------- | --------------- |\\n\"\n        def apkscaleOutputFile = file(\"$buildDir/apkscale/build/outputs/reports/apkscale.json\")\n        def jsonSlurper = new JsonSlurper()\n        def apkscaleOutput = jsonSlurper.parseText(apkscaleOutputFile.text).get(0)\n\n        apkscaleOutput.size.each { arch, sizeImpact -\u003e\n            videoAndroidSizeReport += \"| ${arch.padRight(16)}| ${sizeImpact.padRight(16)}|\\n\"\n\n        }\n        println(sizeReport)\n    }\n}\n```\n\n## Development\n\nDeveloping the plugin requires the Android SDK to be installed and `apkanalyzer` needs to be in your machine's path. The\nproject can be imported into Intellij IDEA CE as a Gradle project.\n\n### Publishing to Maven Local\n\nReference the following snippet to publish the plugin to your local maven repository. Publishing to your local maven\nrepository can be useful when validating changes directly in an Android library project.\n\n```shell\n./gradlew publishApkscaleReleasePublicationToMavenLocal\n```\n\n### Implementation\n\nApkscale builds two flavors of a mock Android application: one without the library and one with the library included. Apkscale then uses the `apkanalyzer` diff operation to produce the size impact of the library.\n\n## License\n\nApache 2.0 license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilio%2Fapkscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilio%2Fapkscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilio%2Fapkscale/lists"}