matrix-apple 0.5.1

matrix-apple 0.5.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'至您的app目标,从命令行运行pod install
    4. 使用Cocoapods生成的.xcworkspace文件进行项目开发;
    5. 添加#import <Matrix/Matrix.h>,然后即可使用微信的性能探测工具。
  • 使用静态框架安装

    1. 获取Matrix的源代码;
    2. matrix/matrix-apple目录下打开终端,执行make进行编译和生成静态库。编译后,iOS平台库在matrix/matrix-apple/build_ios目录中,macOS平台库在matrix/matrix-apple/build_macos目录中。
    3. 在项目中链接静态框架
    • iOS:在matrix/matrix-apple/build_ios路径下使用Matrix.framework,将Matrix.framework链接到项目中作为静态库;
    • macOS:在matrix/matrix-apple/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; // 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 数据格式描述

教程

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

Matrix for android

插件

  • APK 检查器

    分析 APK 包,提出减少 APK 大小的建议;比较两个 APK,找出最大的尺寸增加

  • 资源金丝雀

    基于弱引用和 Square Haha 检测活动泄漏和位图重复

  • 追踪金丝雀

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

  • SQLite Lint

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

  • IO 金丝雀

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

功能

APK 检查器

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

资源验证器

  • 分离检测和分析。 使其在自动化测试和发布版本(仅监控)中变得可能使用。
  • 剪枝 hprof。 删除 hprof 中的无用数据,使其更容易上传。
  • 重复位图的检测。

跟踪验证器

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

SQLite Linter

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

IO Canary

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

开始使用

  1. 在gradle.properties中配置MATRIX_VERSION
  MATRIX_VERSION=0.4.10
  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的更多配置,请参阅示例

注意:您可以在Wiki中获取更多关于Matrix输出的信息 Matrix输出

APK Checker使用方法

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

java -jar matrix-apk-canary-0.4.10.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. 示例中了解更多
  2. 源代码
  3. Wiki & 常见问题解答
  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 对应的目标中,添加 pod 'matrix',然后执行 pod install;
    4. 使用 Cocoapods生成的 .xcworkspace 来运行项目;
    5. 在代码文件头引入头文件 #import ,即可接入微信的性能探针工具!
  • 通过静态库安装

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

启动监控

在以下位置:

  • 程序 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 库开发的 Activity 泄漏和 Bitmap 重复创建检测工具
  • Trace Canary:监控界面流畅度、启动耗时、页面切换耗时、慢函数及卡顿等问题
  • SQLite Lint:按官方最佳实践自动化检测 SQLite 语句的使用质量
  • IO Canary:检测文件 IO 问题,包括:文件 IO 监控和 Closeable Leak 监控

特性

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

APK Checker

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

Resource Canary

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

Trace Canary

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

SQLite Lint

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

IO Canary

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

使用方法

  1. 在项目根目录下的 gradle.properties 中配置要依赖的 Matrix 版本号,例如:
  MATRIX_VERSION=0.4.10
  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.4.10.jar),你可以运行:

java -jar matrix-apk-canary-0.4.10.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. 阅读 Wiki常见问题
  4. 联系我们。

参与贡献

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

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

许可证

Matrix 适用于 BSD 许可证。有关详细信息,请参阅 LICENSE 文件。