All Projects → twilio → Apkscale

twilio / Apkscale

Licence: apache-2.0
A Gradle plugin to measure the app size impact of Android libraries

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Apkscale

Gradle Play Publisher
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
Stars: ✭ 3,690 (+4755.26%)
Mutual labels:  gradle-plugin, android-development
Android Arsenal.com
Source to android-arsenal.herokuapp.com
Stars: ✭ 541 (+611.84%)
Mutual labels:  android-development, android-sdk
Awesome Android Ui
😎 A curated list of awesome Android UI/UX libraries
Stars: ✭ 353 (+364.47%)
Mutual labels:  android-development, android-sdk
AndroidDevTools
收集整理Android开发所需的Android SDK、开发中用到的工具、Android开发教程、Android设计规范,免费的设计素材等。
Stars: ✭ 7,284 (+9484.21%)
Mutual labels:  android-sdk, android-development
Docker Jenkins Android
Jenkins docker image for Android development
Stars: ✭ 35 (-53.95%)
Mutual labels:  android-development, android-sdk
android-jetpack
🚀 Road to Accelerate Android Development using Jetpack
Stars: ✭ 50 (-34.21%)
Mutual labels:  android-sdk, android-development
Android Blogs
Blogs about Android
Stars: ✭ 490 (+544.74%)
Mutual labels:  android-development, android-sdk
laboratory
Feature flags for multi-module Kotlin Android projects
Stars: ✭ 71 (-6.58%)
Mutual labels:  android-development, gradle-plugin
Androidkex
Extensions for Kotlin. Use the power of Kotlin to make your code smaller and beautiful.
Stars: ✭ 35 (-53.95%)
Mutual labels:  android-development, android-sdk
Awesome Android
😎 A curated list of awesome Android resources
Stars: ✭ 26 (-65.79%)
Mutual labels:  android-development, android-sdk
feature-flag-android
A Gradle plugin to achieve feature flag based development for Android applications.
Stars: ✭ 82 (+7.89%)
Mutual labels:  android-development, gradle-plugin
Kotlin Android Scaffolding
An android project structure using kotlin and most common libraries.
Stars: ✭ 53 (-30.26%)
Mutual labels:  android-development, android-sdk
o-fish-android
Android app for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection.
Stars: ✭ 19 (-75%)
Mutual labels:  android-sdk, android-development
Androidsvgdrawable Plugin
Gradle plugin that generates qualified, density specific PNG drawables from SVG files at build time for your Android projects.
Stars: ✭ 263 (+246.05%)
Mutual labels:  gradle-plugin, android-sdk
Android-daily-read-tips
log for articles and info in android for every developer
Stars: ✭ 13 (-82.89%)
Mutual labels:  android-sdk, android-development
Yasea
RTMP live streaming client for Android
Stars: ✭ 4,557 (+5896.05%)
Mutual labels:  android-development, android-sdk
Android-MonetizeApp
A sample which uses Google's Play Billing Library and it makes In-app Purchases and Subscriptions.
Stars: ✭ 149 (+96.05%)
Mutual labels:  android-sdk, android-development
media-picker
Easy customizable picker for all your needs in Android application
Stars: ✭ 167 (+119.74%)
Mutual labels:  android-sdk, android-development
Motiontoast
🌈 A Beautiful Motion Toast Library for Kotlin Android
Stars: ✭ 767 (+909.21%)
Mutual labels:  android-development, android-sdk
Permissionsflow
A simple library to make it easy requesting permissions in Android using Kotlin Coroutines.
Stars: ✭ 49 (-35.53%)
Mutual labels:  android-development, android-sdk

apkscale

CircleCI

A Gradle plugin to measure the app size impact of Android libraries.

apkscale-logo

Requirements

  • Android SDK
  • Apkscale can only be applied within a com.android.library project.
  • apkanalyzer must be in your machine's path
  • Android Gradle Plugin 4.0.0+

Usage

Maven Central

Add the following to your project's buildscript section.

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://repo.gradle.org/gradle/libs-releases' }
        // Include this line if you would like to use snapshots
        maven { url 'https://oss.jfrog.org/artifactory/libs-snapshot/' }
    }
    // Append -SNAPSHOT for snapshot versions
    classpath "com.twilio:apkscale:$apkscaleVersion"
}

Apply the plugin in your Android library project.

apply plugin: 'com.android.library'
apply plugin: 'com.twilio.apkscale'

apkscale {
    // Optional parameter to provide size reports for each ABI in addition to the default universal ABI
    abis = ['x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a']
}

Apkscale 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 <yourProjectBuildDir>/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. Reference the example below.

[
  {
    "library": "your-library-release.aar",
    "size": {
      // Included in all reports
      "universal": "21.9MB",

      // Included as specified by the abis parameter
      "x86": "6MB",
      "x86_64": "6.1MB",
      "armeabi-v7a": "4.8MB",
      "arm64-v8a": "5.7MB"
    }
  }
]

The following demonstrates how to read the Apkscale output and convert it to a markdown table.

task generateSizeReport {
    dependsOn('measureSize')

    doLast {
        def sizeReport = "Size Report\n" +
                "\n" +
                "| ABI             | APK Size Impact |\n" +
                "| --------------- | --------------- |\n"
        def apkscaleOutputFile = file("$buildDir/apkscale/build/outputs/reports/apkscale.json")
        def jsonSlurper = new JsonSlurper()
        def apkscaleOutput = jsonSlurper.parseText(apkscaleOutputFile.text).get(0)

        apkscaleOutput.size.each { arch, sizeImpact ->
            videoAndroidSizeReport += "| ${arch.padRight(16)}| ${sizeImpact.padRight(16)}|\n"

        }
        println(sizeReport)
    }
}

Development

Developing the plugin requires the Android SDK to be installed and apkanalyzer needs to be in your machine's path. The project can be imported into Intellij IDEA CE as a Gradle project.

Publishing to Maven Local

Reference the following snippet to publish the plugin to your local maven repository. Publishing to your local maven repository can be useful when validating changes directly in an Android library project.

./gradlew publishApkscaleReleasePublicationToMavenLocal

Implementation

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

License

Apache 2.0 license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].