降低Android应用程序(APK)尺寸应用程序、尺寸、Android、APK

由网友(Heart tired゛)分享简介:我会是现在公布我在谷歌Play商店的第一个应用。我在我的应用程序中使用已融为一体pressed图像。而且我有一个关于应用程序的大小一些问题。I would be now publishing my first app on Google play store. I have already compressed im...

我会是现在公布我在谷歌Play商店的第一个应用。我在我的应用程序中使用已融为一体pressed图像。而且我有一个关于应用程序的大小一些问题。

I would be now publishing my first app on Google play store. I have already compressed images used in my app. And I have some questions regarding the app size.

如果应用程序的大小是小于2 MB,则有较少的用户会卸载应用程序的机会,是我的这种说法真的属于教育领域?的

If the size of app is less that 2 MB then there are less chances that user will uninstall the app, is my this statement true for apps belonging to education field ?

不过,当我看到我的apk文件在Windows上,它显示3.10 MB,但是当它被安装在设备从应用程序的信息看它表明:

However, When I see my apk file in windows it shows 3.10 MB but when it gets installed in device as viewed from App info it shows:

Total............................8.68 MB
App..............................7.02 MB
USB storage app..................0.00 B
Data.............................1.66 MB (perhaps it is the size of sqlite db + ttf's)
SD card..........................0.00B

那么,为什么我看到在我的应用程序的大小那么多的增加,能不能最小化?的

So, Why do I see that much increase in my app size, Can it be minimized ?

和,我使用4库(罐),在我的项目,该项目是在 Android的私人图书馆,但这些图书馆有自己的这个文件夹外还副本。

And, I am using 4 libraries (jars) in my project which are in Android Private Libraries, but these library have their copy outside this folder also.

是否可以更安全地删除它们,和放大器;删除它们可以帮助减少APK大小?的

Is it safer to delete them, & deleting them can help to decrease apk size?

此外,我也参观了很多的网页描述什么 Proguard的不,我才真正明白Proguard的是如何降低的apk的大小,它缩小,优化和混淆我们的code通过删除未使用code和重命名类,字段和方法与语义模糊的名字。结果是较小尺寸的apk文件,它是更难以逆向工程。但我不知道应该怎么做我的 ProGuard的-project.txt 应该是什么样子? 我在我的应用程序中使用4库即easyfacebookandroidsdk_2.3.jar,android-support-v7-appcompat.jar,google-play-services.jar &放大器; Android的支持 - v4.jar

Also I have visited many web pages describing what Proguard does, I truly understand how Proguard reduces size of apk, it shrinks, optimizes, and obfuscates our code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. But I do not know How should be my proguard-project.txt should look like ? I am using 4 libraries in my app namely easyfacebookandroidsdk_2.3.jar,android-support-v7-appcompat.jar,google-play-services.jar & android-support-v4.jar.

目前我的 ProGuard的-的properties.txt 看起来是这样的:放大器;此外,它不使用的WebView

Currently my proguard-properties.txt looks like this & also it do not uses WebView

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;  
#}
-keep class com.facebook.** { *; }
-keepattributes Signature

所以,我应该补充什么线我的 ProGuard的-的properties.txt ,以便它可以删除未使用的引用,类等,在为了减少APK大小?的

So, what lines should I add in my proguard-properties.txt so that it can remove unused references,classes,etc., in order to reduce the apk size ?

使用AndroidUnusedResources.jar可在https://$c$c.google.com/p/android-unused-resources/发现在Android项目未使用的资源。

Using AndroidUnusedResources.jar available at https://code.google.com/p/android-unused-resources/ finds unused resources in android project.

我觉得这是同样的事情,它的ProGuard已经做了什么?或者应该也使的ProGuard后才能使用?的

I think this is the same thing which proguard has already done ? Or should it also be used after enabling proguard ?

你也可以提到在你的答案任何丢失,你觉得应该共享。 在此先感谢...

Also you can mention in your answer anything that is missing which you feel should be shared. Thanks in Advance...

推荐答案

几乎完全是因为你的资源文件夹的图像!你应该在绘制-MDPI,-hdpi,xhdpi文件夹约4份每幅图像。唯一的区别是,theu都是不同的大小。

So, Why do I see that much increase in my app size, Can it be minimized?

Almost solely because of your res folder images! You should have around 4 copies of each image in the drawable-mdpi, -hdpi, xhdpi folders. The only difference is that theu are all different sizes.

机会是不会有这些jar文件的多个副本!只是一份副本,它的链接!

Chances are there aren't multiple copies of those jar files! Just one copy with links to it!

是的,你说的是对的Proguard的。但是,认识到你所谈论的文本文件在这里。他们是非常小的。我的意思是非常小的尺寸(千字节明智)。你的问题是什么,在兆字节(MB)的大小。这是图像!!!!

Yes, what you said was right about Proguard. However, realize that you are talking about text files here. They are really small. I mean really small in size (kilobyte-wise). Your problem is something in the megabyte (MB) size. That is images!!!!

重复。这是图像!!!!

启用ProGuard的将节省一点点的大小明智的。

Enabling proguard will save a little bit size-wise.

是的,这些都是比较重要的,你的情况。请阅读并应用这些。祝你好运!

Yes, these are all more important in your case. Please read and apply these. Good luck!

如果用户发现你的应用程序有帮助,那么他们将无法将其卸载;然而,有几件事情你可以做

If a user finds your app helpful, then they won't uninstall it; however, there are several things you can do

你能移动图像到Web 和异步到您的应用程序? 确保您的文件的完全融为一体pressed 尽可能多地。使用 pngquant 或 tinypng 。 检查任何重复的图片。你也许可以使用 9补丁吧。 您也许能为让你自己可绘制作为特定的图像。

允许用户为将数据转移到SD卡 Can you move images to the web and async them into your app? Make sure your files are completely compressed as much as possible. Use pngquant or tinypng. Check for any repetition in the images. You might be able to use 9-patch for it. You might be able to make your own drawables for certain images.

Allow users to move data to an SD card.

后的应用程序已 Play商店一会儿,检查开发者控制台,看看它的屏幕尺寸/密度使用最少的。 从你的应用程序中删除该文件夹绘制!这可以减小尺寸量好!但是,检查我的编辑下面这个方法!

After the app has been in the Play Store for a while, check the Developer Console and see which screen size/density is used the least. Remove that drawable folder from your app! This could reduce the size a good amount! But, check my edit below for the cons of this approach!!

您可能想显示一些图像,因为这将让我们看到你正在处理的是什么

You might want to show a few of the images, as that would allow us to see what you are dealing with

@AshwinñBhanushali具有强大的答案这里的问题,我没有回答的一部分,但他基本告诉你,没有什么可以真正做到除了我说的话,加上一个想法或2级以上。

@Ashwin N Bhanushali Has a great answer here for the part of the question I did not answer, but he basically told you that there was nothing you could really do except what I said, plus an idea or 2 more.

我也有另外一个想法是基于对他的想法,甚至会更好一说,由于Android Studio不包括该项目的绘制,LDPI文件夹了。所以,如果你使用Eclipse只会有帮助,我的扩展

I did have another idea that was based on one of his ideas that would be even better, because Android Studio does not include the drawable-ldpi folder in the project anymore. So it would only be helpful if you use Eclipse, mine expands

松开APK到谷歌作出建议修正后的Play商店 经过一段时间已经过去了 - 一个星期,一个月,等等 - 你可以的检查统计应用程序的中的
阅读全文

相关推荐

最新文章