使用tencent-matrix分析apk

2020-11-06  本文已影响0人  RookieRun

1.地址:https://github.com/Tencent/matrix
2.作用

目前我这边只是使用matrix分析apk的组成,并分析出较大的资源文件用以apk瘦身

3.用法

java -jar matrix-apk-canary-0.6.6.jar --config CONFIG-FILE-PATH

4.configFile:

{
  "--apk":apk的绝对路径",
  "--output":"/Users/rookie/Downloads/apk-checker-result",
  "--format":"mm.html,mm.json",
  "--formatConfig":
  [
    {
      "name":"-countMethod",
      "group":
      [
        {
          "name":"Android System",
          "package":"android"
        },
        {
          "name":"java system",
          "package":"java"
        },
        {
          "name":"com.tencent.test.$",
          "package":"com.tencent.test.$"
        }
      ]
    }
  ],
  "options": [
    {
      "name":"-manifest"
    },
    {
      "name":"-fileSize",
      "--min":"10",
      "--order":"desc",
      "--suffix":"png, jpg, jpeg, gif, arsc"
    },
    {
      "name":"-countMethod",
      "--group":"package"
    },
    {
      "name":"-checkResProguard"
    },
    {
      "name":"-findNonAlphaPng",
      "--min":"10"
    },
    {
      "name":"-checkMultiLibrary"
    },
    {
      "name":"-uncompressedFile",
      "--suffix":"png, jpg, jpeg, gif, arsc"
    },
    {
      "name":"-countR"
    },
    {
      "name":"-duplicatedFile"
    },
    {
      "name":"-unusedResources",
      "--rTxt":"R文件的绝对路径位置",
      "--ignoreResources"
      :["R.raw.*",
        "R.style.*",
        "R.attr.*",
        "R.id.*",
        "R.string.ignore_*"
      ]
    },
    {
      "name":"-unusedAssets",
      "--ignoreAssets":["*.so" ]
    }
  ]
}

5.结果:


image.png
上一篇下一篇

猜你喜欢

热点阅读