当前位置:网站首页>Performance optimized APK slimming
Performance optimized APK slimming
2022-07-28 23:06:00 【ZZ White Dragon】
Basic slimming
1. Tools (Lint Test code )

arrow 1: Comprehensive testing
Examine dimensions :
Daniel's article :
https://www.cnblogs.com/andy-songwei/p/7090934.html
http://www.javashuo.com/article/p-vtcbvgwr-nc.html
arrow 2: According to the specific test type lint
2. The image processing :
1. Picture compression
Batch compression is recommended ( The use of plug-in :TinyPngPlugin)
1、Tools --> TinyPngPlugin
2. use WebP Format
3. Confusion handling minifyEnabled true
4. Resource reduction shrinkResources true
Note if there are some resource files that are not sure to use , I dare not delete , Or not sure if the requirements will change , So keep it first ,
have access to shrinkResources To reduce resources
5. Useless so file , Three party Library , Two party Library , And the deletion and reduction of reusable third-party libraries
6. In order to solve the complex tripartite library introduced by simple functions , Try to refer only to their implementation , Avoid introducing third-party libraries
7. Remove unused spare resources
defaultConfig { resConfigs(“en”,“zh”,“zh-rCN”) } The same goes for resource files
defaultConfig { resConfigs(“xxhdpi”,“xxxhdpi”) }
Slimming advanced
1. Resource confusion resources.arsc Resource confusion
Reference resources AndResGuard
2.ReDex
dex Files are the product of packaging ,redex yes facebook Open source subcontracting optimization scheme . You can refer to :ReDex.
3.so Dynamic loading
about so After reduction ,so The proportion of documents is still relatively large , Other than the first start-up can be considered so Dynamic distribution of documents . That is, the idea of plug-in , Load on demand , But while the benefits are great , There's also a lot of risk ,
There's a lot of case Need to take into account , For example, download time 、 The network environment 、 Thread process , If loading fails, whether there is a degradation strategy, etc .
You can refer to facebook Open source SoLoader.
4. pluggable
Load on demand , The greater the return, the greater the risk , The risk is the same as above. .
5. Native switch to H5 Or small programs
6. Picture networking
Upload the picture to the server , Reduce the package volume through dynamic download , The disadvantage is that the first load depends on the network environment , For loading speed , The flow needs to be balanced . Pictures can be preloaded , But traffic consumption is unavoidable , If you care about traffic indicators , It needs to be weighed .
7.DebugItem
DebugItem It mainly contains two kinds of information :
Debugging information . Parameter variables and all local variables of the function .
Troubleshooting information . Correspondence between all instruction set line numbers and source file line numbers .
Remove debug Information and line number information , If not the ultimate , Not recommended . You can refer to this article by Alipay. Alipay App Build optimization resolution :Android Package size is extremely compressed .
8.R Field inline
inline R Field Can solve R Field Too much leads to MultiDex 65536 The problem of , And this step can play a significant effect on code downsizing .
Reference bytes are open source shrink-r-plugin, And Didi's open source booster, Meituan scheme
9. Picture shader
Processing for different colors in the same image , have access to tint, For example, it was originally a black return icon, Now the other page is going to be white , You don't need two pictures ,
But use tint To change it to white .
10. Reduce ENUM Use
Every time you cut one ENUM Can be reduced by about 1.0 To 1.4 KB Size .
The idea of reducing body size :
Packet volume monitoring
Package volume monitoring should be a part of the release process , It's best to be a platform 、 Process , Otherwise it will be difficult to continue , In a few versions, the package volume has risen again .
General idea : Compare the package size of the current version with that of the previous version , exceed 200KB Approval required . For temporary approval, follow-up optimization schemes need to be given .
边栏推荐
猜你喜欢

Xshell7, xftp7 personal free version official download, no need to crack, no activation, download and use

can‘t convert cuda:0 device type tensor to numpy. Use Tensor. cpu() to copy the tensor to host memory

18张图,直观理解神经网络、流形和拓扑

Improvement 11 of yolov5: replace backbone network C3 with lightweight network mobilenetv3

Target detection notes SSD

frontiers出版社投稿记录(附状态变化)

The industry's first cloud native security detection dual model! Safety dog heavyweight report appears at the digital China Construction Summit
![[physical application] Wake induced dynamic simulation of underwater floating wind turbine wind field with matlab code](/img/31/e4cd4c261a7fc5cfa731976314530b.png)
[physical application] Wake induced dynamic simulation of underwater floating wind turbine wind field with matlab code

Paper reading: deep forest / deep forest /gcforest

Learning experience sharing 4: learning experience of yolov7
随机推荐
【MySQL系列】 MySQL表的增删改查(进阶)
The safety dog has been selected into many details of cloud security panorama 2.0
安全狗入选《云安全全景图2.0》多个细项
Xshell7, xftp7 personal free version official download, no need to crack, no activation, download and use
DirectX repair tool download (where is exagear simulator package)
A new paradigm of distributed deep learning programming: Global tensor
Sqlilabs-1 (breakthrough record)
Morphology of image
Invest 145billion euros! EU 17 countries announce joint development of semiconductor technology
Console.log() console display... Solution
无代码开发平台管理后台入门教程
Learning experience sharing 4: learning experience of yolov7
Shell script foundation - shell operation principle + variable and array definitions
无代码开发平台通讯录导出入门教程
Written questions and answers of software test interview (software test question bank)
PCA学习
Xinhuazhang announced the completion of more than 200million a-round financing and the comprehensive layout of eda2.0 R & D
(important) first knowledge of C language -- function
Introduction to address book export without code development platform
[radar] radar signal online sorting based on kernel clustering with matlab code