减少apk大小android [英] Reduce apk size android

查看:34
本文介绍了减少apk大小android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 android 中遇到了应用大小问题.

I am facing a problem with app size in android.

场景是,

我在 Android Studio 2.0 中开发了我的 android 应用程序,apk 的大小为 23 MB.

I developed my android app in Android Studio 2.0 and the size of apk was 23 MB.

在那之后,我将我的 IDE 升级到了 android studio 2.2,并且几乎没有修改代码,apk 的大小就增加到了 51 MB.

After that, I upgraded my IDE to android studio 2.2 and with little code modification the size of apk boosted to 51 MB.

我尝试使用 prorogued 和 Lint 但没有优势.

I tried with prorogued and Lint but no advantage.

谁能帮我解决这个问题.

Can Someone help me to tackle the issue.

推荐答案

1) 将所有的 Image,Icons 替换为 vector drawable

1) Replace all of Images,Icons with vector drawable

2) 像下面这样开启专业防护转到 build.gradleapp 级别

2) Turn on pro guard like following goto build.gradleapp level

并放置这些行

**shrinkResources 为真

**shrinkResources true

minifyEnabled true**

minifyEnabled true**

3) 删除未使用的类、drawable 以及方法和字符串并使用 LINT 的私有方法分析器,减少方法数量

3) Remove unused classes,drawable and methods and strings and use LINT's private method analyser which reduces method count

JAVA 的隐藏成本

4) 在 android studio 2.2 及更高版本中,他们在 Build 菜单中添加了 apk 分析器 工具.用它来分析APk

4) In android studio 2.2 and above they have added apk analyser tool in Build menu. Use that to analyse APk

5) 如果应用程序大小超过 100mb,则使用称为 split apk 的功能.有两种拆分apk的方法ABI 和密度拆分

5) if app size goes beyond 100mb use feature called split apk. there are two methods of spliting apk ABI and Density Splits

这篇关于减少apk大小android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆