Skip to content
🚀Optimizer for mobile applications
Branch: master
Clone or download
Latest commit a10fc0a May 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets [skip ci] Add assets/booster-global-callgraph.dot.png May 21, 2019
booster-aapt2 Remove module booster-aapt Apr 29, 2019
booster-android-api [skip ci] Add README.md for each module Apr 27, 2019
booster-android-gradle-api Fix issue #28 May 24, 2019
booster-android-gradle-v3_0 Add compatibility API for android gradle 3.3+ May 10, 2019
booster-android-gradle-v3_2 Add compatibility API for android gradle 3.3+ May 10, 2019
booster-android-gradle-v3_3 Add compatibility API for android gradle 3.3+ May 10, 2019
booster-android-instrument-shared-preferences Commit optimizations for shared preferences Apr 30, 2019
booster-android-instrument-thread Performance optimization May 5, 2019
booster-android-instrument-toast Refactor toast-related modules Apr 30, 2019
booster-android-instrument Refactor toast-related modules Apr 30, 2019
booster-gradle-plugin Add INFO log for booster transform May 13, 2019
booster-kotlinx Fix compilation issue on amd64 linux & #23 May 22, 2019
booster-task-all Refactor `booster-task-compression` May 8, 2019
booster-task-artifact Update build.gradle, using `implementation` instead of `compile` May 9, 2019
booster-task-compression Remove log May 26, 2019
booster-task-dependency Rename control sequence introducer May 18, 2019
booster-task-permission Rename control sequence introducer May 18, 2019
booster-task-spi [skip ci] Add README.md for each module Apr 27, 2019
booster-transform-all Commit optimizations for multithreading #12 Apr 30, 2019
booster-transform-asm Code optimization May 5, 2019
booster-transform-lint Update lint API list May 26, 2019
booster-transform-shared-preferences Generating report file for `booster-transform-shared-preferences` May 3, 2019
booster-transform-shrink Fix issue #28 May 24, 2019
booster-transform-spi Improve shrink transformer #8 May 3, 2019
booster-transform-thread Code optimization May 5, 2019
booster-transform-toast Fix stack over flow caused by custom Toast #3 May 6, 2019
booster-transform-usage Rename control sequence introducer May 18, 2019
booster-transform-util Add INFO log for transformer May 17, 2019
buildSrc Fix generated `REVISION` Apr 27, 2019
gradle Fix issue #4: WARNING: API 'variant.getJavaCompiler()' is obsolete an… Apr 28, 2019
license Supports webp compression May 19, 2019
.gitignore init Apr 23, 2019
.travis.yml Integrates with travis CI Apr 24, 2019
CONTRIBUTING.md init Apr 23, 2019
LICENSE.txt init Apr 23, 2019
README.md Release version 0.4.4 May 26, 2019
build.gradle Release version 0.4.4 May 26, 2019
gradlew init Apr 23, 2019
gradlew.bat init Apr 23, 2019
settings.gradle Refactor `booster-task-compression` May 8, 2019

README.md

Booster

GitHub Travis (.org) GitHub release

Overview | 概览

Booster is an easy-to-use, lightweight, powerful and extensible quality optimization toolkit designed specially for mobile applications. Using the dynamic discovering and loading mechanism, Booster provides the ability for customizing. In other words, Booster is a quality optimization framework for mobile applications.

Booster 是专门为移动应用而设计的简单易用、轻量级、功能强大且可扩展的质量优化工具包,其通过动态发现和加载机制提供可扩展的能力,换言之,Booster 也是一个移动应用质量优化框架。

Booster consists chiefly of transformers and tasks, transformers are used for byte code scanning or manipulation (depends on the transformer's functionalities), tasks are used for artifact processing, to satisfy specialized optimization requirements, Booster provides Transformer SPI and VariantProcessor SPI for developers to support customization. The following figure shows the architecture of Booster:

Booster 主要由 Transformer 和 Task 组成,Transformer 主要用于对字节码进行扫描或修改(取决于 Transformer 的功能),Task 主要用于构建过程中的资源处理,为了满足特异的优化需求,Booster 提供了 Transformer SPI and VariantProcessor SPI 允许开发者进行定制,以下是 Booster 的整体框架:

Booster Architecture

What can Booster be used for? | Booster 能做什么?

  • Detecting performance issues | 检测性能问题

    Potential performance issues could be found by using Booster, for example, calling APIs that may block the UI thread or main thread, such as I/O APIs. About the details, please see booster-transform-lint.

    使用 Booster 可以发现潜在的性能问题,例如,在应用中调用可能阻塞 UI 线程或者主线程的 API,如:I/O API。详见 booster-transform-lint

  • Optimizing runtime performance | 优化运行时性能

    Thread management has always been a problem for developers, especially the threads started by third-party SDKs, starting too many threads may cause OOM, fortunately, these issues can be solved by Booster. About multithreading performance optimization, please see booster-transform-thread.

    对于开发者来说,线程管理一直是个头疼的问题,特别是第三方 SDK 中的线程,过多的线程可能会导致内存不足,然而幸运的是,这些问题都能通过 Booster 来解决。关于多线程性能优化,详见 booster-transform-thread

  • Fixing system bugs | 修复系统错误

    Such as fixing the crash caused by Toast globally on Android API 25.

    例如全局性地修复 Android API 25 版本中 Toast 导致的崩溃。

  • Reducing app size | 为应用瘦身

    Such as image resources compression, constants removal, etc.

    图片资源压缩代码中常量的删除,都可以通过 Booster 来完成。

  • Other things you can imagine | 其它你能想像得到的

Prerequisite | 先决条件

  • Gradle version 4.1+ | Gradle 4.1 以上版本
  • Android Gradle Plugin version 3.0+ | Android Gradle 插件 3.0 以上版本

Getting Started | 快速上手

The plugin can be added to the buildscript classpath and applied:

buildscript 的 classpath 中引入 Booster 插件,然后启用该插件:

buildscript {
    ext.booster_version = '0.4.4'
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "com.didiglobal.booster:booster-gradle-plugin:$booster_version"
        classpath "com.didiglobal.booster:booster-task-all:$booster_version"
        classpath "com.didiglobal.booster:booster-transform-all:$booster_version"
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.didiglobal.booster'

Booster is a modularized project, and the optimizer consist of gradle plugin and a dozen of transformers. This means, at least one transformer must be explicitly depended to have the desired effect. Conveniently, the booster-transform-all module can be depended to enable all optimization options.

Booster 是一个模块化的工程,其优化器由 Gradle 插件和一系列 Transformer 组成,这意味着,至少需要显式地依赖一个 transformer 才能得到预期的效果。为了方便起见,可以通过依赖 booster-transform-all 模块来启用所有的优化项。

In addition, Booster provides a collection of Gradle Task to help developers be more efficient. Conveniently, the booster-task-all module can be depended to enable all tasks.

另外,Booster 也提供了一系列的 Gradle Task 来帮助开发者提升效率,为了方便起见,可以通过依赖 booster-task-all 来启用所有的 task。

Then build an optimized package by executing the assemble task, after the build process completed, the reports could be found at build/reports/.

然后通过执行 assemble task 来构建一个优化过的应用包,构建完成后,在 build/reports/ 目录下会生成相应的报告。

$ ./gradlew assembleRelease

Documentation | 文档

About the details, please see Wiki.

详见 Wiki

Contributing

Welcome to contribute by creating issues or sending pull requests. See Contributing Guideline.

欢迎大家以 issue 或者 pull request 的形式为本项本作贡献。详见 Contributing Guideline

Community

Welcome to join the community on spectrum.

License

Booster is licensed under the Apache License 2.0.

You can’t perform that action at this time.