ADT (Eclipse) vs. Android Studio:APK 文件大小相差多少是正常的? [英] ADT (Eclipse) vs. Android Studio: How much APK file size difference is normal?

查看:20
本文介绍了ADT (Eclipse) vs. Android Studio:APK 文件大小相差多少是正常的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 ADT 项目导入到最新版本的 Android Studio (0.6.1).这两个项目共享相同的代码和库.此外,这两个项目都已清除并在启用相同 ProGuard 设置的情况下进行编译.

I imported a ADT project to the latest version of Android Studio (0.6.1). Both projects share the same code and libraries. Also both projects were cleared and compiled with the same ProGuard settings enabled.

但 ADT APK 文件大小为 1.8 MB,Android Studio APK 文件大小为 2.7 MB.

But the size of the ADT APK file is 1.8 MB and the Android Studio APK file is 2.7 MB.

这种 APK 文件大小增加 50% 是否被认为是正常的,因为 Android Studio 仍处于抢先体验预览阶段,还是我应该能够获得几乎相同的 APK 文件大小?

Is this increase of 50% in APK file size considered as normal due to the fact that Android Studio is still in Early Access Preview or should I be able to get nearly the same APK file size?

(更新:我刚刚解压了 APK 文件:所有文件的大小几乎相同,但不同之处在于 classes.dex 文件的大小为 1.2 MBAndroid Studio 上的 ADT 和 4.4 MB.)

(Update: I just unzipped the APK file: All files are nearly the same size, but the difference comes from the classes.dex file which is 1.2 MB on ADT and 4.4 MB on Android Studio.)

推荐答案

通过对 classes.dex 文件进行逆向工程,我发现我的代码在 Android Studio 中没有被混淆.

By reverse engineering the classes.dex files I found out that my code wasn't obfuscated in Android Studio.

尽管在我看来 ProGuard 是通过我的 build.gradle 中的 runProguard true 启用的,并且在生成签名的 APK 文件之前要求 ProGuard 的复选框.

Even though it seemed to me that ProGuard was enabled via runProguard true in my build.gradle and the checkbox asking for ProGuard before generating the signed APK file.

我必须按照此处所述将应用模块的构建变体从调试更改为发布.

I had to change the build variant of the app module from debug to release as described here.

现在两个 APK 文件几乎相同大小(1.812 与 1.817 MB).

Now both APK files are almost the same size (1.812 vs. 1.817 MB).

这篇关于ADT (Eclipse) vs. Android Studio:APK 文件大小相差多少是正常的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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