如何在android中生成小apk

[英]How to generate small apk in android


I have prepared Android Applications which contains 8 Activities. 1st Default activity contains only two EditText to get username and password and 2 Buttons(one for login and other for new user registration) In registration activity there are 6 EditText and 6 TextView. and in remaining all activity there is only one TextView with Small line is written,

我准备了包含8个活动的Android应用程序。第一个默认活动只包含两个EditText来获取用户名和密码以及两个按钮(一个用于登录,另一个用于新用户注册)在注册活动中有6个EditText和6个TextView。并且在剩下的所有活动中只有一个带有小行的TextView被写入,

But when I check size of APK file it shows me 411 KB. How can I generate small APK.

但是,当我检查APK文件的大小时,它显示我411 KB。我怎样才能生成小APK。

Thanks in Advance

提前致谢

2 个解决方案

#1


3  

411KB is already pretty small for an android application.

对于Android应用程序,411KB已经相当小了。

Most are at least 1 or 2 megabytes. I don't think you need to worry about the size of your application as it stands at the moment.

大多数是至少1或2兆字节。我认为您不必担心应用程序的大小。

However, if you really want to reduce the size of your APK, you could make sure to delete any redundant resources, or (as Richard Le Mesurier said) try using ProGuard.

但是,如果您真的想减小APK的大小,可以确保删除任何冗余资源,或者(如Richard Le Mesurier所说)尝试使用ProGuard。

#2


2  

To add to what Tom Leese said in his answer, you could run ProGuard on your build.

为了补充Tom Leese在回答中所说的内容,您可以在构建中运行ProGuard。

That will result in an optimally small APK.

这将导致最佳的小APK。

Edit your project.properties file and look for the line that says:

编辑project.properties文件并查找说明的行:

# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

When you run an external signed build using the Android Tools menu, ProGuard will shrink your app.

使用Android工具菜单运行外部签名版本时,ProGuard会缩小您的应用。

More info on ProGuard here - http://proguard.sourceforge.net/index.html#

有关ProGuard的更多信息,请访问http://proguard.sourceforge.net/index.html#


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/03/05/bfb2aff2358ae4de2b3e902890dfc408.html



 
  © 2014-2022 ITdaan.com 联系我们: