问题描述
我在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.
我尝试了protgued和Lint,但没有优势.
I tried with prorogued and Lint but no advantage.
有人可以帮我解决这个问题吗?
Can Someone help me to tackle the issue.
推荐答案
1)将所有图像,图标替换为矢量可绘制
1) Replace all of Images,Icons with vector drawable
2)像下面那样打开专业防护转到build.gradleapp级别
2) Turn on pro guard like followinggoto build.gradleapp level
并把这些行
** shrinkResources为真
**shrinkResources true
minifyEnabled是**
minifyEnabled true**
3)删除未使用的类,可绘制对象以及方法和字符串并使用LINT的专用方法分析器来减少方法计数
3) Remove unused classes,drawable and methods and stringsand use LINT's private method analyser which reduces method count
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 apkABI and Density Splits
这篇关于减少apk大小android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!