国内 Top500Android 应用分析报告
AleNgabidj
8年前
<h2>背景</h2> <p>笔者目前在开发的应用在线上有不少OOM的问题,经过一番优化后,OOM降了一个量级,但由于产品中Gif是一特色,内存占用优化空间比较有限,想要减少OOM最简单的办法可能就是开启largeHeap。Google官方是不推荐使用largeheap的,更大的内存意味着更长的垃圾回收时间,所以我就想看看国内的这些应用是否有打开largeheap。用AS的APK Analyzer看了下微信和QQ空间,发现大家都打开了,然后我就安心了。</p> <p>后来,我们打算把Jackson库换掉,太占用方法数了,可选择的有Gson和Fastjson。同样去看看国内的App都在用什么吧,本以为Fastjson号称速度最快,国内又是主场,应该用的人更多一些,但在手动分析了几个APP后,发现大家都在用Gson,Fastjson反而没见到几个。</p> <p>再后来,有一天晚上,好像看了篇TK教主的文章就来了灵感,觉得可以批量分析一下国内主流的APP,看看大家都在用什么库,教父整天说据我所知,国内用哪些团队在用rxjava,我可以来个更全面准确的分析,顺便可以看看我的Nuwa是否有人在用?</p> <h2>分析</h2> <p>豌豆荚正好那几天被收购了,那就拿他开刀吧,脚本下载了排行榜(周下载量)Top500的应用,使用Android SDK自带的appt和dexdump,分析Manifest文件和dex文件,拿到一些APK基本信息和dex中的Class Descriptor。</p> <p>有些有插件化能力的或者没有用MultiDex的应用,可能dex不在常规位置,比如淘宝把dex伪装成.so文件,所以需要查看文件的magic number来找到dex文件。</p> <p>涉及到数据的排序和整理,所以使用了mysql数据库,Class Descriptor通过package分段聚合,package最多保留四段,比如Lcom/jiajixin/nuwa/utils/dex/,会有 com/* 、 com/jiajixin/ 、 com/jiajixin/nuwa/ 、 com/jiajixin/nuwa/utils/ 入库,然后group by后根据count倒序输出,人工匹配对应库名。</p> <h2>数据</h2> <p>废话不多说,直接展示数据。</p> <h3>APK基本信息</h3> <p><img src="https://simg.open-open.com/show/d8068adaa25388f445d1fa9e5eee32c3.jpg"></p> <p><img src="https://simg.open-open.com/show/79ad4d74d834665cc305103513d3ed83.jpg"></p> <p><img src="https://simg.open-open.com/show/eeb76aee3f260d8be8ec609b9160c167.jpg"></p> <p><img src="https://simg.open-open.com/show/a064209819a76a463aabe4c435b0f992.jpg"></p> <h3>开源项目</h3> <p>Network:</p> <table> <thead> <tr> <th>Okttp</th> <th>Volley</th> <th>android-async-http</th> </tr> </thead> <tbody> <tr> <td>135</td> <td>105</td> <td>58</td> </tr> </tbody> </table> <p>ImagecLoader:</p> <table> <thead> <tr> <th>Universal Image Loader</th> <th>Fresco</th> <th>Glide</th> <th>Picasso</th> </tr> </thead> <tbody> <tr> <td>130</td> <td>88</td> <td>54</td> <td>38</td> </tr> </tbody> </table> <p>Dependency Injection:</p> <table> <thead> <tr> <th>ButterKnife</th> <th>Dagger</th> <th>Android Annotations</th> <th>Roboguice</th> </tr> </thead> <tbody> <tr> <td>63</td> <td>16</td> <td>11</td> <td>5</td> </tr> </tbody> </table> <p>Json:</p> <table> <thead> <tr> <th>Gson</th> <th>Fastjson</th> <th>Jackson</th> </tr> </thead> <tbody> <tr> <td>227</td> <td>87</td> <td>26</td> </tr> </tbody> </table> <p>Protocol Buffers:</p> <table> <thead> <tr> <th>Wire</th> <th>Protobuf</th> </tr> </thead> <tbody> <tr> <td>72</td> <td>67</td> </tr> </tbody> </table> <p>DataBase:</p> <table> <thead> <tr> <th>GreenDao</th> <th>OrmLite</th> </tr> </thead> <tbody> <tr> <td>41</td> <td>27</td> </tr> </tbody> </table> <p>Event:</p> <table> <thead> <tr> <th>EventBus</th> <th>Otto</th> </tr> </thead> <tbody> <tr> <td>132</td> <td>12</td> </tr> </tbody> </table> <p>HotFix:</p> <table> <thead> <tr> <th>Andfix</th> <th>Dexposed</th> <th>Nuwa</th> </tr> </thead> <tbody> <tr> <td>34</td> <td>24</td> <td>7</td> </tr> </tbody> </table> <p>Plugin:</p> <table> <thead> <tr> <th>Droidplugin</th> <th>Dynamic-Load-Apk</th> <th>DynamicAPK</th> <th>Pluginmgr</th> </tr> </thead> <tbody> <tr> <td>8</td> <td>5</td> <td>7</td> <td>1</td> </tr> </tbody> </table> <p>PullToRefresh:</p> <table> <thead> <tr> <th>Android-PullToRefresh</th> <th>android-Ultra-Pull-To-Refresh</th> </tr> </thead> <tbody> <tr> <td>92</td> <td>27</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Name</th> <th>Users</th> </tr> </thead> <tbody> <tr> <td>NineOldAndroids</td> <td>150</td> </tr> <tr> <td>zxing</td> <td>121</td> </tr> <tr> <td>okio</td> <td>119</td> </tr> <tr> <td>thrift</td> <td>97</td> </tr> <tr> <td>bolts</td> <td>76</td> </tr> <tr> <td>android-gif-drawable</td> <td>72</td> </tr> <tr> <td>spdy</td> <td>63</td> </tr> <tr> <td>photoview</td> <td>62</td> </tr> <tr> <td>iflytek</td> <td>61</td> </tr> <tr> <td>rxjava</td> <td>50</td> </tr> <tr> <td>pinyin4j</td> <td>46</td> </tr> <tr> <td>viewpagerindicator</td> <td>46</td> </tr> <tr> <td>jsr305</td> <td>42</td> </tr> <tr> <td>ijkplayer</td> <td>41</td> </tr> <tr> <td>DanmakuFlameMaster</td> <td>36</td> </tr> <tr> <td>retrofit</td> <td>26</td> </tr> <tr> <td>DragSortListView</td> <td>23</td> </tr> <tr> <td>exoplayer</td> <td>23</td> </tr> <tr> <td>MPAndroidChart</td> <td>23</td> </tr> <tr> <td>rebound</td> <td>22</td> </tr> <tr> <td>jsoup</td> <td>21</td> </tr> <tr> <td>leakcanary</td> <td>21</td> </tr> <tr> <td>android-gpuimage</td> <td>20</td> </tr> <tr> <td>daimajia</td> <td>20</td> </tr> <tr> <td>xutils</td> <td>19</td> </tr> <tr> <td>Android-wheel</td> <td>18</td> </tr> <tr> <td>roundedimageview</td> <td>18</td> </tr> <tr> <td>PagerSlidingTabStrip</td> <td>16</td> </tr> <tr> <td>SmoothProgressBar</td> <td>16</td> </tr> <tr> <td>stetho</td> <td>16</td> </tr> <tr> <td>aspectj</td> <td>15</td> </tr> <tr> <td>bouncycastle</td> <td>14</td> </tr> <tr> <td>soloader</td> <td>14</td> </tr> <tr> <td>tagsoup</td> <td>14</td> </tr> <tr> <td>vitamio</td> <td>14</td> </tr> <tr> <td>dom4j</td> <td>13</td> </tr> <tr> <td>afinal</td> <td>12</td> </tr> <tr> <td>cropper</td> <td>12</td> </tr> <tr> <td>Android-Easing</td> <td>11</td> </tr> <tr> <td>react-native</td> <td>11</td> </tr> <tr> <td>slidingmenu</td> <td>11</td> </tr> <tr> <td>zip4j</td> <td>11</td> </tr> <tr> <td>disklrucache</td> <td>10</td> </tr> <tr> <td>swipebacklayout</td> <td>10</td> </tr> <tr> <td>java_websocket</td> <td>9</td> </tr> <tr> <td>realm</td> <td>4</td> </tr> </tbody> </table> <p>这些产品在使用rxjava:</p> <p><img src="https://simg.open-open.com/show/29ea265c1b054cec2ea1ed906b5fcb38.png"></p> <p>这些产品在使用react-native:</p> <p><img src="https://simg.open-open.com/show/8bc3c497bc41f687eb1eee7fd813faa8.jpg"></p> <p>上面这两张图献给教父。</p> <h3>第三方服务</h3> <p><img src="https://simg.open-open.com/show/cb1e68684c167ee7ecbccac2a7fbe1cc.jpg"></p> <p><img src="https://simg.open-open.com/show/8a1b33c5d6a4d3518046da4e113fe893.jpg"></p> <p><img src="https://simg.open-open.com/show/9acbc94ae960141e1c12ad824c099813.png"></p> <p> </p> <p>来自: <a href="http://mp.weixin.qq.com/s?__biz=MzA5OTMxMjQzMw==&mid=2648112527&idx=1&sn=b23c1b5f3e32e343ad96d705bd4d63ff&scene=1&srcid=0711SVtLTxYXurfDvMqW2LJi#wechat_redirect" rel="nofollow">http://mp.weixin.qq.com/s?__biz=MzA5OTMxMjQzMw==&mid=2648112527&idx=1&sn=b23c1b5f3e32e343ad96d705bd4d63ff&scene=1&srcid=0711SVtLTxYXurfDvMqW2LJi#wechat_redirect</a></p> <p> </p>