Eclipse Export Signed Package 添加了两次可绘制目录,使 apk 大小加倍!
我从 2.1 左右就注意到了这一点。我相信问题出在 Eclipse Export to APK 插件或我的设置中的其他地方(尽管我不知道它可能在哪里)。
基本上,我的 APK 大小突然增加了一倍!一些调查显示 Eclipse 现在包含了可绘制目录(以及 raw、layout 和 xml 目录)两次。它一次将其包含在 res 子目录下,一次包含在应用程序的根目录下。
因此,不要有这样的目录结构:
- com
- META-INF
- res
- drawable
- layout
- raw
- xml
...
我有:
- com
- drawable
- layout
- META-INF
- raw
- res
- drawable
- layout
- raw
- xml
- values
- values-fr
- xml
还有其他人经历过这种情况吗?有谁知道为什么会这样?它将我的应用程序大小从 3mb 增加到了 6mb 以上,这是一个大问题。
我当前的解决方法是使用 eclipse 导出未签名的包,从根目录中删除可绘制、布局、原始和 xml 文件,然后手动对其进行签名并 zipalign。
如果您想查看该 apk,请查看此 apk(有问题) 和此 apk (我已手动修复)。两者都可以,其中一个只是两倍大。
我正在使用 Eclipse SDK,版本:3.5.2,构建 ID:M20100211-1343,Android 开发工具包版本:10.0.1.v201103111512-110841,尽管自从 2.1 发布以来,我在最后几个 ADT 中遇到了问题。我编译的 APK 级别似乎并不重要。
感谢您的帮助,见解!
I have noticed this since about 2.1. I believe the problem is in the Eclipse Export to APK plugin or else somewhere in my setup (though I have no idea where it could be).
Basically, all of a sudden my APK sizes doubled! Some investigating revealed that Eclipse was now including the drawable directory (and the raw, layout, and xml directories) twice. It includes it once under the res subdirectory and once under the root directory of the application.
So, instead of having a directory structure like:
- com
- META-INF
- res
- drawable
- layout
- raw
- xml
...
I have:
- com
- drawable
- layout
- META-INF
- raw
- res
- drawable
- layout
- raw
- xml
- values
- values-fr
- xml
Has anyone else experienced this? Does anyone know why this might be? It increased my app size from 3mb to over 6mb, which is a big deal.
My current workaround is to export an unsigned package with eclipse, remove the drawable, layout, raw, and xml files from the root directory, then manually sign it and zipalign it.
If you want to look at the apk, check out this apk (with the problem) and this apk (that I have fixed manually). Both work, one is just twice as big.
I am using Eclipse SDK, Version: 3.5.2, Build id: M20100211-1343, Android Development Toolkit Version: 10.0.1.v201103111512-110841, Though I have had the problem for the last couple of ADTs, since 2.1 came out. It doesn't seem to matter what APK level I compile for.
Thanks for any help, insight!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于解决了这个问题!
由于某种原因,我的 .classpath 文件中有一个错误,我自己从未编辑过这个文件,但在所有机器、Eclipse 版本和 SDK 版本之间的迁移中,它一定已经丢失了。
它显示:
将其更改为:
解决了问题。耶皮!
I have solved this finally!
For some reason, there was an error in my .classpath file, I have never edited this file myself but in all the migrations between machines, versions of eclipse, and versions of the SDK, it must have slipped it.
It read:
Changing it to:
Fixed the problem. Yippee!