尝试了一切:仍然如何减小我的 apk 大小?

Tried everything : Still how can I reduce my apk size ?

如何更有效地减小我的 apk 大小?我知道这是一个常见问题,但我没有得到可用资源的太多帮助。

Proguard 应该是正确的选择,因为它删除了未使用的代码并将 variable/method 名称重命名为类似 a、b、c、aa、ab 的名称。

可以减少多少?这取决于。我的情况是使用 Proguard 将 10M apk 减少到 8M。

安全吗? Proguard 的目的之一是混淆代码,使其难以进行逆向工程。

您可以使用以下方法:

1) use proguard : set minifyEnabled true

2) Remove unused resources : set shrinkResources true

3) Remove everything that you are not using

4) If you are using librarires ,try finding the snippet that you are really using,if you dont find any such version,try fiddling with the required class directly in your app instead of importing whole library

5) Use vector drawable instead of pngs for your small icons and drawables

6) Reduce png images clarity to point where it have same effect to human eye ,while its size is reduced heavily

7) Try generating resources or draws on runtime instead of storing it before hand

Progaurd 是完全安全的,请确保在使用 proguard 之前对您的工作进行原始备份,并在激活 proguard.Generally 提供默认 proguard 的库之前对所有库和其他重要资源和代码使用正确的规则他们的图书馆规则