简体   繁体   English

如何减少 Android 中的 APK 大小?

[英]How to reduce APK size in Android?

have developed a simple Android application.开发了一个简单的Android应用程序。 Its APK size is 24MB.它的APK大小为 24MB。 Can anyone tell me how to reduce the APK size?谁能告诉我如何减小 APK 大小?

There are some things to do in order to reduce app size, which are为了减小应用程序的大小,有一些事情要做,它们是

  1. Reduce the use of jpeg/png drawable: if you have raw resource files such as pdf, jpeg, png, gif, or any others.减少 jpeg/png 可绘制对象的使用:如果您有原始资源文件,例如 pdf、jpeg、png、gif 或任何其他文件。 These things will consume a major part of your app size.这些东西将消耗你应用程序大小的主要部分。 Remove such resources as much as possible.尽可能删除此类资源。 You can try loading them from the web您可以尝试从网络加载它们
  2. Use Vector images as much as possible尽可能使用矢量图像
  3. Use proguard: This reduce your app size significantly使用 proguard:这会显着减小您的应用程序大小
  4. Use app bundle to distribute instead of apk使用 app bundle 分发而不是 apk

Try these things and you can reduce your apk size significantly.试试这些东西,你可以显着减少你的 apk 大小。 Also, try using APK analyzer to see what is causing too much app size.此外,尝试使用 APK 分析器查看导致应用程序大小过大的原因。 there might be some 3rd party libraries also causing issues.可能有一些 3rd 方库也会导致问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM