/booster

🚀Optimizer for mobile applications

Primary LanguageKotlinApache License 2.0Apache-2.0

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. The primary goal is to solve quality problems with the increase of APP complexity, such as performance, stability, and package size, etc.

Booster provides a collection of modules for performance detection, multithreading optimization, resources index inline, redundant resources reduction, resources compression, system bug fixing, etc. Using booster, the stability of application can be increased by 15% ~ 25%, and the package size can be reduced by 1MB ~ 10MB.

Booster 是一款专门为移动应用设计的易用、轻量级且可扩展的质量优化框架,其目标主要是为了解决随着 APP 复杂度的提升而带来的性能、稳定性、包体积等一系列质量问题。

Booster 提供了性能检测、多线程优化、资源索引内联、资源去冗余、资源压缩、系统 Bug 修复等一系列功能模块,可以使得稳定性能够提升 15% ~ 25%,包体积可以减小 1MB ~ 10MB。

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

Prerequisite | 先决条件

  • Gradle version 4.1+
  • Android Gradle Plugin version 3.0+ (3.2.0+ is recommended)

Getting Started | 快速上手

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

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

buildscript {
    ext.booster_version = '0.22.0'
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
    }
    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"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
    }
}

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

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

Best Practise | 最佳实践

The integration method above is just for convenience, the best practise of using Booster is integrating the specific moudle to solve the problems you have encountered as following:

上面关于集成 Booster 的方式只是为了方便,集成 Booster 的最佳方式是集成真正需要的模块来解决项目中遇到的特定问题。

buildscript {
    ext.booster_version = '0.22.0'
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
    }
    dependencies {
        classpath "com.didiglobal.booster:booster-gradle-plugin:$booster_version"
        // figure out the features you really need, then choose the right module for integration
        // 弄清楚真正需要的特性,然后从下面的模块列表中选择正确的模块进行集成
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
    }
}

Here are all the modules of Booster:

Performance

Package Size

  • booster-task-compression - 资源压缩

    classpath "com.didiglobal.booster:booster-task-compression:$booster_version"
  • booster-transform-shrink - 资源索引内联及常量字段删除

    classpath "com.didiglobal.booster:booster-transform-shrink:$booster_version"

System Bug

  • booster-transform-finalizer-watchdog-daemon - 修复 finalizer 导致的 TimeoutException

    classpath "com.didiglobal.booster:booster-transform-finalizer-watchdog-daemon:$booster_version"
  • booster-transform-media-player - 修复 MediaPlayer 崩溃

    classpath "com.didiglobal.booster:booster-transform-media-player:$booster_version"
  • booster-transform-res-check - 检查覆盖安装导致的 ResourcesAssets 未加载的 Bug

    classpath "com.didiglobal.booster:booster-transform-res-check:$booster_version"
  • booster-transform-toast - 修复 Toast 在 Android 7.1 上的 Bug

    classpath "com.didiglobal.booster:booster-transform-toast:$booster_version"
  • booster-transform-activity-thread - 处理系统 Crash

    classpath "com.didiglobal.booster:booster-transform-activity-thread:$booster_version"

Utility

  • booster-task-check-snapshot - 检查 SNAPSHOT 版本

    classpath "com.didiglobal.booster:booster-task-check-snapshot:$booster_version"
  • booster-task-list-permission - 显示 AAR 使用的权限清单

    classpath "com.didiglobal.booster:booster-task-list-permission:$booster_version"
  • booster-task-list-shared-library - 显示 AAR 包含的动态库清单

    classpath "com.didiglobal.booster:booster-task-list-shared-library:$booster_version"

Samples | 示例

Documentation | 文档

About the details, please see 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.