🚀Optimizer for mobile applications
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。
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-task-analyser.
使用 Booster 可以发现潜在的性能问题,例如,在应用中调用可能阻塞 UI 线程或者主线程的 API,如:I/O API 等。详情请参见: booster-task-analyser。
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 the details, please see booster-transform-thread。
对于开发者来说,线程管理一直是个头疼的问题,特别是第三方 SDK 中的线程,过多的线程可能会导致内存不足,然而幸运的是,这些问题都能通过 Booster 来解决。
Such as fixing the crash caused by
Toastglobally on Android API 25. About the details, please see booster-transform-toast and booster-transform-shared-preferences.
例如全局性地修复 Android API 25 版本中
Toast导致的崩溃。详情请参见:booster-transform-toast、booster-transform-shared-preferences.
Such as image resources compression, r inline, etc.
1.8is recommended)
4.1+
3.0+
The following table lists which version of Gradle is required for each version of the Android Gradle plugin. For the best performance, please use the latest possible version of both Gradle and the plugin.
下表列出了各个 Android Gradle 插件版本所需的 Gradle 版本。要获得最佳性能,请使用 Gradle 和插件这两者的最新版本。
| Android Gradle Plugin | Gradle | |:---------------------:|:--------:| | 3.0.0+ | 4.1+ | | 3.1.0+ | 4.4+ | | 3.2.0 - 3.2.1 | 4.6+ | | 3.3.0 - 3.3.3 | 4.10.1+ | | 3.4.0 - 3.4.3 | 5.1.1+ | | 3.5.0 - 3.5.4 | 5.4.1+ | | 3.6.0 - 3.6.4 | 5.6.4+ | | 4.0.0+ | 6.1.1+ | | 4.1.0+ | 6.5+ |
The best practise of using Booster is integrating the specific module to solve the problems you have encountered as following:
集成 Booster 的最佳方式是集成真正需要的模块来解决项目中遇到的特定问题。
buildscript { ext.booster_version = '3.1.0' repositories { google() mavenCentral() jcenter()// OPTIONAL If you want to use SNAPSHOT version, sonatype repository is required. 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()
// OPTIONAL If you want to use SNAPSHOT version, sonatype repository is required. maven { url 'https://oss.sonatype.org/content/repositories/public' } }
}
apply plugin: 'com.android.application' apply plugin: 'com.didiglobal.booster' // ③
The
pluginsDSL also supported since Booster 3.0.0
Here are all the modules of Booster:
implementation "com.didiglobal.booster:booster-aapt2:$booster_version"
this module contains both booster-transform-spi and booster-task-spi
implementation "com.didiglobal.booster:booster-api:$booster_version"
implementation "com.didiglobal.booster:booster-cha:$booster_version"
implementation "com.didiglobal.booster:booster-command:$booster_version"
classpath "com.didiglobal.booster:booster-task-analyser:$booster_version"
classpath "com.didiglobal.booster:booster-transform-thread:$booster_version"
classpath "com.didiglobal.booster:booster-transform-webview:$booster_version"
SharedPreferences优化
classpath "com.didiglobal.booster:booster-transform-shared-preferences:$booster_version"
classpath "com.didiglobal.booster:booster-task-compression-cwebp:$booster_version"
The option
android.precompileDependenciesResourcesneed to be set on Android Gradle Plugin 3.6 and higher
android.precompileDependenciesResources=false
classpath "com.didiglobal.booster:booster-task-compression-pngquant:$booster_version"
The option
android.precompileDependenciesResourcesneed to be set on Android Gradle Plugin 3.6 and higher
android.precompileDependenciesResources=false
booster-pngquant-provider could be used for image compressing by pngquant without installation
classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
classpath "com.didiglobal.booster:booster-task-resource-deredundancy:$booster_version"
The option
android.precompileDependenciesResourcesneed to be set on Android Gradle Plugin 3.6 and higher
android.precompileDependenciesResources=false
classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"
classpath "com.didiglobal.booster:booster-transform-br-inline:$booster_version"
TimeoutException
classpath "com.didiglobal.booster:booster-transform-finalizer-watchdog-daemon:$booster_version"
classpath "com.didiglobal.booster:booster-transform-media-player:$booster_version"
classpath "com.didiglobal.booster:booster-transform-res-check:$booster_version"
classpath "com.didiglobal.booster:booster-transform-toast:$booster_version"
classpath "com.didiglobal.booster:booster-transform-activity-thread:$booster_version"
classpath "com.didiglobal.booster:booster-task-check-snapshot:$booster_version"
classpath "com.didiglobal.booster:booster-task-list-permission:$booster_version"
classpath "com.didiglobal.booster:booster-task-list-shared-library:$booster_version"
About the details, please see Booster Inside(深入理解 Booster)
About the API reference, please see Booster API Reference
Welcome to contribute by creating issues or sending pull requests. See Contributing Guideline.
欢迎大家以 issue 或者 pull request 的形式为本项目作贡献。详见 Contributing Guideline。
Booster is licensed under the Apache License 2.0.