Skip to content

Commit b068a38

Browse files
authored
Update README.md
1 parent ddc7abb commit b068a38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ afterEvaluate {
9898
###坑6:主dex依然爆表,shit again!
9999
其实上面那段脚本已经成功筛选出我们想要放入主Dex的`manifest_keep列表``maindexlist列表`,但是在打包的时候还是把所有类打进主Dex(已无语)。这个时候就需要跟[DexKnifePlugin](https://github.com/ceabie/DexKnifePlugin)插件配合使用,首先在gradle中加上上述脚本,然后使用插件时在配置文件中加上 `-split **.**``#-donot-use-suggest`。DexKnifePlugin插件运行原理很简单,在生成Dex任务之前首先读取自己的配置文件(包含前面我们通过Gradle脚本生成的`maindexlist`列表),然后扫描combined.jar(包含工程中所有.class文件)匹配出我们自定义的maindexlist.txt,再替换掉build/multi-dex/maindexlist.txt,和build实例。这样分包的时候就会基于我们的规则生成主Dex。
100100

101+
###坑7:ANR,HAHAHA!
102+
我们最低API=16,测试并未发现ANR问题,所以暂时没考虑景上添花,这个问题比较好解决。
103+
参考=>[Android Dex分包之旅](http://yydcdut.com/2016/03/20/split-dex/index.html)
104+
101105
###Congratulation
102106
恭喜,填坑终于结束,不过还有点不爽的是需要同时维护Gradle脚本和插件的配置。
103107
于是乎就将Gradle脚本整合进了插件,这样只需维护一个配置文件就行了。读者可以根据自己需求自行选择分开配置还是整合配置。通过这种方式我们把主Dex的方法数维持在15000左右,从此再也不用担心方法数问题了!!!
@@ -176,4 +180,4 @@ Unsupported major.minor version 52.0
176180
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
177181
> DexKnife Warnning: Main dex is EMPTY ! Check your config and project!
178182
```
179-
gradle 切到 1.5.0
183+
gradle 切到 1.5.0,目前就发现gradle 2.1.2有这问题。

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy