matrix-wechat 1.0.1

matrix-wechat 1.0.1

johnzjchen 维护。



  • johnzjchen

Matrix-icon

licensePRs WelcomeWeChat Approved

(中文版本请参看这里)

Matrix for iOS/macOS 中文版
Matrix for android 中文版
Matrix for iOS/macOS
Matrix for android

Matrix 是微信中使用的一种 APM(应用性能管理),用于监控、定位和分析性能问题。它是一个 插件式非侵入式 的解决方案,目前可在 iOS、macOS 和 Android 上运行。

Matrix for iOS/macOS

当前工具的监控范围包括:崩溃、卡顿和内存溢出,涵盖了以下两个插件

  • WCCrashBlockMonitorPlugin: 基于 KSCrash 框架,具有结合崩溃捕获的领先的卡顿堆栈捕获功能。

  • WCMemoryStatPlugin: 一个性能优化的内存溢出监控工具,可以捕获应用内存分配和内存溢出事件的调用栈。

特性

WCCrashBlockMonitorPlugin

  • 易于集成,无需修改代码。
  • 通过检查 Runloop 的运行状态来判定应用是否卡死,支持 iOS 和 macOS 平台。
  • 添加耗时堆栈获取,将耗时最长的主线程堆栈附加到线程快照日志中。

WCMemoryStatPlugin

  • 实时记录每个对象的创建及其创建时的调用堆栈,并在检测到应用程序内存不足时进行报告。
  • 使用平衡二叉树存储活动对象,并使用哈希表存储调用堆栈来极大优化性能

入门指南

安装

  • 通过Cocoapods安装

    1. 安装 CocoaPods;
    2. 运行 pod repo update 使Cocoapods了解最新的matrix版本;
    3. 在Podfile中添加 pod 'matrix-wechat' 到您的应用目标,从命令行运行 pod install
    4. 使用Cocoapods生成的.xcworkspace文件来工作;
    5. 添加 #import <Matrix/Matrix.h> ,然后您可以使用微信的性能探针工具。
  • 使用静态框架安装

    1. 获取Matrix的源代码;
    2. 打开终端,在matrix/matrix-iOS目录中执行make以编译和生成静态库。编译后,iOS平台库在matrix/matrix-iOS/build_ios目录中,macOS平台库在matrix/matrix-iOS/build_macos目录中。
    3. 在项目中链接静态框架
    • iOS : 在matrix/matrix-iOS/build_ios路径下使用Matrix.framework,将Matrix.framework链接到项目作为静态库;
    • macOS : 在matrix/matrix-iOS/build_macos路径下使用Matrix.framework,将Matrix.framework链接到项目作为静态库。
    1. 添加 #import <Matrix/Matrix.h>,然后您可以使用微信的性能探针工具。

启动插件

以下位置

  • 程序中的main函数;
  • AppDelegateapplication:didFinishLaunchingWithOptions:
  • 或者应用启动后尽可能早运行的其他位置。

添加如下相似的代码以启动插件

#import <Matrix/Matrix.h>
  
Matrix *matrix = [Matrix sharedInstance];
MatrixBuilder *curBuilder = [[MatrixBuilder alloc] init];
curBuilder.pluginListener = self; // get the related event of plugin via the callback of the pluginListener
    
WCCrashBlockMonitorPlugin *crashBlockPlugin = [[WCCrashBlockMonitorPlugin alloc] init];    
[curBuilder addPlugin:crashBlockPlugin]; // add lag and crash monitor.
    
WCMemoryStatPlugin *memoryStatPlugin = [[WCMemoryStatPlugin alloc] init];
[curBuilder addPlugin:memoryStatPlugin]; // add out-of-memory monitor.
    
[matrix addMatrixBuilder:curBuilder];
    
[crashBlockPlugin start]; // start the lag and crash monitor.
// [memoryStatPlugin start];  
// start out-of-memory monitor
// Be careful, WCMemoryStatPlugin has a large performance loss after it is turned on. It is recommended to turn it on as needed.

接收回调以获取监控数据

设置MatrixBuilder对象的pluginListener,实现MatrixPluginListenerDelegate

// set delegate

MatrixBuilder *curBuilder = [[MatrixBuilder alloc] init];
curBuilder.pluginListener = <object conforms to MatrixPluginListenerDelegate>; 

// MatrixPluginListenerDelegate

- (void)onInit:(id<MatrixPluginProtocol>)plugin;
- (void)onStart:(id<MatrixPluginProtocol>)plugin;
- (void)onStop:(id<MatrixPluginProtocol>)plugin;
- (void)onDestroy:(id<MatrixPluginProtocol>)plugin;
- (void)onReportIssue:(MatrixIssue *)issue;

每当向 MatrixBuilder 中添加插件时,都会通过 pluginListener 调用对应的事件。

重要:通过 onReportIssue: 获取矩阵的监控数据,数据格式信息参考Matrix for iOS/macOS 数据格式描述

教程

此时,矩阵已集成到应用中,开始收集崩溃、延迟和内存不足数据。如果仍有疑问,请查看示例:samples/sample-apple/MatrixDemo

Matrix for android

插件

  • APK检查器

    分析APK包,提供建议以减小APK的大小;比较两个APK,找出最大的增量。

  • 资源金丝雀

    基于WeakReference和Square Haha检测活动泄漏和位图重复。

  • 追踪金丝雀

    帧率监控、启动性能、UI-Block/慢方法检测

  • SQLite检查器

    使用SQLite官方工具自动评估SQLite语句的质量。

  • IO金丝雀

    检测文件IO问题,包括文件IO性能和可关闭泄漏。

功能

APK检查器

  • 易于使用的。 Matrix提供了一个JAR工具,这使其更方便应用到您的集成系统中。
  • 更多功能。 除了APK分析器,Matrix还能检测R资源冗余、静态链接STL的动态库、未使用资源,并支持自定义检测规则。
  • 视觉输出。 支持HTML和JSON输出。

资源检查器

  • 独立检测和分析。 使其可在自动化测试和发布版本中使用(仅监控)。
  • 优化Hprof。 删除hprof中的无用数据,以便更容易上传。
  • 重复位图的检测。

跟踪检查器

  • 高性能。 在编译时动态修改字节码,记录函数成本和调用堆栈,性能损失很小。
  • 精确的ui-block调用栈。 提供调用栈、函数成本、执行时间等信息,快速解决ui-block的问题。
  • 不侵入式。 兼容性高,适用于多种Android版本。
  • 更多功能。 自动覆盖多个流畅度指标,如ui-block、启动时间、活动切换、慢函数检测。

SQLite Lint

  • 易于使用。 无侵入。
  • 高适用性。 无论数据量大小,您都可以在开发和测试中发现SQLite性能问题。
  • 高标准。 基于最佳实践检测算法,使SQLite语句达到最高质量。
  • 可能支持多平台。 使用C++实现,使其能够支持多平台。

IO检查器

  • 易于使用。 无侵入。
  • 更多功能。 包括文件IO性能和可关闭泄漏。
  • 兼容Android P。

入门指南

  1. 在gradle.properties中配置MATRIX_VERSION
  MATRIX_VERSION=0.6.5
  1. 在您的build.gradle中添加matrix-gradle-plugin
  dependencies {
      classpath ("com.tencent.matrix:matrix-gradle-plugin:${MATRIX_VERSION}") { changing = true }
  }
 
  1. 在您的app/build.gradle中添加依赖项。
  dependencies {
    implementation group: "com.tencent.matrix", name: "matrix-android-lib", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-android-commons", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-trace-canary", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-resource-canary-android", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-resource-canary-common", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-io-canary", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-sqlite-lint-android-sdk", version: MATRIX_VERSION, changing: true
  }
  
  apply plugin: 'com.tencent.matrix-plugin'
  matrix {
    trace {
        enable = true	//if you don't want to use trace canary, set false
        baseMethodMapFile = "${project.buildDir}/matrix_output/Debug.methodmap"
        blackListFile = "${project.projectDir}/matrixTrace/blackMethodList.txt"
    }
  }
  1. 通过实现 PluginListener 接收 Matrix 处理的数据。
  public class TestPluginListener extends DefaultPluginListener {
    public static final String TAG = "Matrix.TestPluginListener";
    public TestPluginListener(Context context) {
        super(context);
        
    }

    @Override
    public void onReportIssue(Issue issue) {
        super.onReportIssue(issue);
        MatrixLog.e(TAG, issue.toString());
        
        //add your code to process data
    }
}
  1. 通过实现 DynamicConfig 来更改 Matrix 的参数。
  public class DynamicConfigImplDemo implements IDynamicConfig {
    public DynamicConfigImplDemo() {}

    public boolean isFPSEnable() { return true;}
    public boolean isTraceEnable() { return true; }
    public boolean isMatrixEnable() { return true; }
    public boolean isDumpHprof() {  return false;}

    @Override
    public String get(String key, String defStr) {
        //hook to change default values
    }

    @Override
    public int get(String key, int defInt) {
      //hook to change default values
    }

    @Override
    public long get(String key, long defLong) {
        //hook to change default values
    }

    @Override
    public boolean get(String key, boolean defBool) {
        //hook to change default values
    }

    @Override
    public float get(String key, float defFloat) {
        //hook to change default values
    }
}
  1. 在应用 onCreate 方法中初始化 Matrix。
  Matrix.Builder builder = new Matrix.Builder(application); // build matrix
  builder.patchListener(new TestPluginListener(this)); // add general pluginListener
  DynamicConfigImplDemo dynamicConfig = new DynamicConfigImplDemo(); // dynamic config
  
  // init plugin 
  IOCanaryPlugin ioCanaryPlugin = new IOCanaryPlugin(new IOConfig.Builder()
                    .dynamicConfig(dynamicConfig)
                    .build());
  //add to matrix               
  builder.plugin(ioCanaryPlugin);
  
  //init matrix
  Matrix.init(builder.build());

  // start plugin 
  ioCanaryPlugin.start();

更多 Matrix 配置请参考sample

注意:您可以在 GitHub 上的 wiki 中了解更多关于 Matrix 输出的信息:Matrix 输出

APK Checker 使用方法

APK Checker 可以以 Jar 形式独立运行(matrix-apk-canary-0.6.5.jar),用法

java -jar matrix-apk-canary-0.6.5.jar
Usages: 
    --config CONFIG-FILE-PATH
or
    [--input INPUT-DIR-PATH] [--apk APK-FILE-PATH] [--unzip APK-UNZIP-PATH] [--mappingTxt MAPPING-FILE-PATH] [--resMappingTxt RESGUARD-MAPPING-FILE-PATH] [--output OUTPUT-PATH] [--format OUTPUT-FORMAT] [--formatJar OUTPUT-FORMAT-JAR] [--formatConfig OUTPUT-FORMAT-CONFIG (json-array format)] [Options]
    
Options:
-manifest
     Read package info from the AndroidManifest.xml.
-fileSize [--min DOWN-LIMIT-SIZE (KB)] [--order ORDER-BY ('asc'|'desc')] [--suffix FILTER-SUFFIX-LIST (split by ',')]
     Show files whose size exceed limit size in order.
-countMethod [--group GROUP-BY ('class'|'package')]
     Count methods in dex file, output results group by class name or package name.
-checkResProguard
     Check if the resguard was applied.
-findNonAlphaPng [--min DOWN-LIMIT-SIZE (KB)]
     Find out the non-alpha png-format files whose size exceed limit size in desc order.
-checkMultiLibrary
     Check if there are more than one library dir in the 'lib'.
-uncompressedFile [--suffix FILTER-SUFFIX-LIST (split by ',')]
     Show uncompressed file types.
-countR
     Count the R class.
-duplicatedFile
     Find out the duplicated resource files in desc order.
-checkMultiSTL  --toolnm TOOL-NM-PATH
     Check if there are more than one shared library statically linked the STL.
-unusedResources --rTxt R-TXT-FILE-PATH [--ignoreResources IGNORE-RESOURCES-LIST (split by ',')]
     Find out the unused resources.
-unusedAssets [--ignoreAssets IGNORE-ASSETS-LIST (split by ',')]
     Find out the unused assets file.
-unstrippedSo  --toolnm TOOL-NM-PATH
     Find out the unstripped shared library file.

了解更多关于 Matrix-APKChecker

支持

有什么问题吗?

  1. 更多样例可以参考 Sample
  2. 源代码
  3. Wiki常见问题解答(FAQ)
  4. 联系我们寻求帮助

贡献

如果您有兴趣贡献代码,请查看 CONTRIBUTING.md,同时加入我们的 腾讯开源计划

许可证

Matrix 遵循 BSD 许可协议。具体细节请参阅 LICENSE 文件。


Matrix

Matrix-icon licensePRs Welcome WeChat Approved

Matrix 是微信研发并日常使用的应用性能接入框架,支持 iOS,macOS 和 Android。Matrix 通过接入各种性能监控方案,对性能监控项的异常数据进行采集和分析,输出相应的问题分析、定位和优化建议,帮助开发者开发出更高质量的应用。

Matrix for iOS/macOS

当前工具监控范围包括:崩溃、卡顿和爆内存,包含以下两款插件:

  • WCCrashBlockMonitorPlugin: 基于 KSCrash 框架开发,具有业界领先的卡顿堆栈捕获能力,同时兼备崩溃捕获能力。

  • WCMemoryStatPlugin: 一款性能优化到极致的爆内存监控工具,能够全面捕获应用爆内存时的内存分配以及调用堆栈情况。

特性

WCCrashBlockMonitorPlugin

  • 接入简单,代码无侵入
  • 通过检查 Runloop 运行状态判断应用是否卡顿,同时支持 iOS/macOS 平台
  • 增加耗时堆栈提取,卡顿线程快照日志中附加最近时间最耗时的主线程堆栈

WCMemoryStatPlugin

  • 在应用运行期间获取对象存活以及相应的堆栈信息,在检测到应用爆内存时进行上报
  • 使用平衡二叉树存储存活对象,使用 Hash Table 存储堆栈,将性能优化到极致

使用方法

安装

  • 通过 Cocoapods 安装

    1. 先安装 CocoaPods
    2. 通过 pod repo update 更新 matrix 的 Cocoapods 版本;
    3. 在 Podfile 对应的 target 中,添加 pod 'matrix-wechat',并执行 pod install;
    4. 在项目中使用 Cocoapods 生成的 .xcworkspace 运行工程;
    5. 在你的代码文件头引入头文件 #import <Matrix/Matrix.h>,就可以接入微信的性能探针工具了!
  • 通过静态库安装

    1. 获取 Matrix 源码;
    2. 打开命令行,在 matrix/matrix-iOS 代码目录下执行 make 进行编译生成静态库;编译完成后,iOS 平台的库在 matrix/matrix-iOS/build_ios 目录下,macOS 平台的库在 matrix/matrix-iOS/build_macos 目录下;
    3. 工程引入静态库:
    • iOS 平台:使用 matrix/matrix-iOS/build_ios 路径下的 Matrix.framework,将 Matrix.framework 以静态库的方式导入工程;
    • macOS 平台:使用 matrix/matrix-iOS/build_macos 路径下的 Matrix.framework,将 Matrix.framework 以静态库的方式导入工程。
    1. 添加头文件 #import <Matrix/Matrix.h>,即可接入微信的性能探针工具!

启动监控

在以下位置:

  • 程序的 main 函数入口;
  • AppDelegate 中的 application:didFinishLaunchingWithOptions:
  • 或者是应用启动较早的时间点。

添加类似以下代码,启动插件:

#import <Matrix/Matrix.h>
  
Matrix *matrix = [Matrix sharedInstance];
MatrixBuilder *curBuilder = [[MatrixBuilder alloc] init];
curBuilder.pluginListener = self; // pluginListener 回调 plugin 的相关事件
    
WCCrashBlockMonitorPlugin *crashBlockPlugin = [[WCCrashBlockMonitorPlugin alloc] init];    
[curBuilder addPlugin:crashBlockPlugin]; // 添加卡顿和崩溃监控
    
WCMemoryStatPlugin *memoryStatPlugin = [[WCMemoryStatPlugin alloc] init];
[curBuilder addPlugin:memoryStatPlugin]; // 添加内存监控功能
    
[matrix addMatrixBuilder:curBuilder];
    
[crashBlockPlugin start]; // 开启卡顿和崩溃监控
// [memoryStatPlugin start]; 
// 开启内存监控,注意 memoryStatPlugin 开启之后对性能损耗较大,建议按需开启

接收回调获得监控数据

设置 MatrixBuilder 对象的 pluginListener,实现 MatrixPluginListenerDelegate。

// 设置 delegate

MatrixBuilder *curBuilder = [[MatrixBuilder alloc] init];
curBuilder.pluginListener = <一个遵循 MatrixPluginListenerDelegate 的对象>; 

// MatrixPluginListenerDelegate

- (void)onInit:(id<MatrixPluginProtocol>)plugin;
- (void)onStart:(id<MatrixPluginProtocol>)plugin;
- (void)onStop:(id<MatrixPluginProtocol>)plugin;
- (void)onDestroy:(id<MatrixPluginProtocol>)plugin;
- (void)onReportIssue:(MatrixIssue *)issue;

添加到 MatrixBuilder 的各个 plugin 会通过 pluginListener 回调对应的事件。

重要:通过 onReportIssue: 获得Matrix处理后的数据,监控数据格式详见:Matrix for iOS/macOS 数据格式说明

Demo

至此,Matrix 已集成到应用中并开始收集崩溃、卡顿和内存占用数据,如仍有疑问,请查看示例:samples/sample-apple/MatrixDemo

Matrix for Android

Matrix-android 当前监控范围包括:应用安装包大小,帧率变化,启动耗时,卡顿,慢方法,SQLite 操作优化,文件读写,内存泄漏等等。

  • APK Checker:针对 APK 安装包的分析检测工具,根据一系列预设规则,检测 APK 是否存在特定问题,并输出较详细的检测结果报告,用于分析排查问题和版本追踪。
  • Resource Canary:基于 WeakReference 特性和 Square Haha 库开发的活动泄漏和位图重复创建检测工具。
  • Trace Canary:监控界面流畅性、启动耗时、页面切换耗时、慢函数及卡顿等问题。
  • SQLite Lint:按官方最佳实践自动化检测 SQLite 语句的使用质量。
  • IO Canary:检测文件 IO 问题,包括:文件 IO 监控和 Closeable Leak 监控。

特性

与常规的 APM 工具相比,Matrix 拥有以下特点:

APK 检查器

  • 更好的可用性:以 JAR 包形式提供,更方便应用于持续集成系统中,用于追踪和比较每个 APK 版本之间的变化
  • 更多的检查分析功能:除了具备 APKAnalyzer 的功能外,还支持统计 APK 中包含的 R 类、检查是否存在多个动态库静态链接了 STL、搜索 APK 中包含的无用资源,以及支持自定义检查规则等
  • 输出的检查结果更加详细:支持可视化 HTML 格式,便于分析和处理 JSON 格式,支持自定义输出等

资源检查器

  • 分离了检测和分析部分,便于在不打断自动化测试的前提下持续输出分析后的检测结果
  • 对检测部分生成的 Hprof 文件进行了裁剪,移除了大部分无用数据,降低了传输 Hprof 文件的开销
  • 增加了重复 Bitmap 对象检测,方便通过减少冗余 Bitmap 数量,降低内存消耗

跟踪检查器

  • 编译期动态修改字节码,高性能记录执行耗时与调用堆栈
  • 准确地定位到发生卡顿的函数,提供执行堆栈、执行耗时、执行次数等信息,帮助快速解决卡顿问题
  • 自动覆盖卡顿、启动耗时、页面切换、慢函数检测等多个流畅性指标

SQLite 检查器

  • 接入简单,代码无侵入
  • 数据量无关,开发、测试阶段即可发现 SQLite 性能隐患
  • 检测算法基于最佳实践,严格把控 SQLite 质量*
  • 底层是 C++ 实现,支持跨平台扩展

IO 检查器

  • 接入简单,代码无侵入
  • 性能、泄漏全面监控,对 IO 质量心中有数
  • 兼容至 Android P

使用方法

  1. 在你的项目根目录下的 gradle.properties 中配置要依赖的 Matrix 版本号,例如:
  MATRIX_VERSION=0.6.5
  1. 在你的项目根目录下的 build.gradle 文件添加 Matrix 依赖,例如:
  dependencies {
      classpath ("com.tencent.matrix:matrix-gradle-plugin:${MATRIX_VERSION}") { changing = true }
  }
  1. 然后,在 app/build.gradle 文件中添加 Matrix 各模块的依赖,例如:
  dependencies {
    implementation group: "com.tencent.matrix", name: "matrix-android-lib", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-android-commons", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-trace-canary", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-resource-canary-android", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-resource-canary-common", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-io-canary", version: MATRIX_VERSION, changing: true
    implementation group: "com.tencent.matrix", name: "matrix-sqlite-lint-android-sdk", version: MATRIX_VERSION, changing: true
  }

  apply plugin: 'com.tencent.matrix-plugin'
  matrix {
    trace {
        enable = true	//if you don't want to use trace canary, set false
        baseMethodMapFile = "${project.buildDir}/matrix_output/Debug.methodmap"
        blackListFile = "${project.projectDir}/matrixTrace/blackMethodList.txt"
    }
  }
  1. 实现 PluginListener 接口,以接收 Matrix 处理后的数据,例如:
  public class TestPluginListener extends DefaultPluginListener {
    public static final String TAG = "Matrix.TestPluginListener";
    public TestPluginListener(Context context) {
        super(context);
        
    }

    @Override
    public void onReportIssue(Issue issue) {
        super.onReportIssue(issue);
        MatrixLog.e(TAG, issue.toString());
        
        //add your code to process data
    }
}
  1. 实现动态配置接口,可以修改 Matrix 内部参数。在 sample-android 中我们有一个简单的动态接口示例 DynamicConfigImplDemo.java,其中参数对应的 key 位于文件 MatrixEnum 中,部分示例如下:
  public class DynamicConfigImplDemo implements IDynamicConfig {
    public DynamicConfigImplDemo() {}

    public boolean isFPSEnable() { return true;}
    public boolean isTraceEnable() { return true; }
    public boolean isMatrixEnable() { return true; }
    public boolean isDumpHprof() {  return false;}

    @Override
    public String get(String key, String defStr) {
        //hook to change default values
    }

    @Override
    public int get(String key, int defInt) {
         //hook to change default values
    }

    @Override
    public long get(String key, long defLong) {
        //hook to change default values
    }

    @Override
    public boolean get(String key, boolean defBool) {
        //hook to change default values
    }

    @Override
    public float get(String key, float defFloat) {
        //hook to change default values
    }
}
  1. 选择程序启动的位置对 Matrix 进行初始化,如在 Application 的继承类中, Init 核心逻辑如下:
  Matrix.Builder builder = new Matrix.Builder(application); // build matrix
  builder.patchListener(new TestPluginListener(this)); // add general pluginListener
  DynamicConfigImplDemo dynamicConfig = new DynamicConfigImplDemo(); // dynamic config
  
  // init plugin 
  IOCanaryPlugin ioCanaryPlugin = new IOCanaryPlugin(new IOConfig.Builder()
                    .dynamicConfig(dynamicConfig)
                    .build());
  //add to matrix               
  builder.plugin(ioCanaryPlugin);
  
  //init matrix
  Matrix.init(builder.build());

  // start plugin 
  ioCanaryPlugin.start();

至此,Matrix 已成功集成到你的项目中,并且开始收集和分析性能相关异常数据,如有疑问,请查看 示例

PS:Matrix 分析后的输出字段的含义请查看 Matrix 输出内容的含义解析

APK Checker

APK Check 以独立的 jar 包提供 (matrix-apk-canary-0.6.5.jar),你可以运行:

java -jar matrix-apk-canary-0.6.5.jar

查看 Usages 来使用它。

Usages: 
    --config CONFIG-FILE-PATH
or
    [--input INPUT-DIR-PATH] [--apk APK-FILE-PATH] [--unzip APK-UNZIP-PATH] [--mappingTxt MAPPING-FILE-PATH] [--resMappingTxt RESGUARD-MAPPING-FILE-PATH] [--output OUTPUT-PATH] [--format OUTPUT-FORMAT] [--formatJar OUTPUT-FORMAT-JAR] [--formatConfig OUTPUT-FORMAT-CONFIG (json-array format)] [Options]
    
Options:
-manifest
     Read package info from the AndroidManifest.xml.
-fileSize [--min DOWN-LIMIT-SIZE (KB)] [--order ORDER-BY ('asc'|'desc')] [--suffix FILTER-SUFFIX-LIST (split by ',')]
     Show files whose size exceed limit size in order.
-countMethod [--group GROUP-BY ('class'|'package')]
     Count methods in dex file, output results group by class name or package name.
-checkResProguard
     Check if the resguard was applied.
-findNonAlphaPng [--min DOWN-LIMIT-SIZE (KB)]
     Find out the non-alpha png-format files whose size exceed limit size in desc order.
-checkMultiLibrary
     Check if there are more than one library dir in the 'lib'.
-uncompressedFile [--suffix FILTER-SUFFIX-LIST (split by ',')]
     Show uncompressed file types.
-countR
     Count the R class.
-duplicatedFile
     Find out the duplicated resource files in desc order.
-checkMultiSTL  --toolnm TOOL-NM-PATH
     Check if there are more than one shared library statically linked the STL.
-unusedResources --rTxt R-TXT-FILE-PATH [--ignoreResources IGNORE-RESOURCES-LIST (split by ',')]
     Find out the unused resources.
-unusedAssets [--ignoreAssets IGNORE-ASSETS-LIST (split by ',')]
     Find out the unused assets file.
-unstrippedSo  --toolnm TOOL-NM-PATH
     Find out the unstripped shared library file.

由于篇幅影响,此次不再赘述,我们在 Matrix-APKChecker 中进行了详细说明。

支持

还有其他问题?

  1. 查看示例
  2. 阅读源码
  3. 阅读 WikiFAQ
  4. 联系我们。

贡献

关于 Matrix 分支管理、issue 以及 pr 规范,请阅读 Matrix Contributing Guide

腾讯开源激励计划 鼓励开发者的参与和贡献,期待你的加入。

许可协议

Matrix 遵循 BSD 许可协议。具体细节请参阅 LICENSE 文件。