【问题标题】:APK size is bigger than expected - android studioAPK 大小比预期的要大 - android studio
【发布时间】:2014-03-30 15:37:02
【问题描述】:

我的项目内容大小是这样的,

  1. 主项目(源和资产大小 513KB)
  2. 模块 1(源和资产大小 135KB)
  3. 模块 2(源和资产大小 80KB)

apk(签名,调试两者)大小为 4.87MB。也试过 ProGuard 没有任何改变。

我不明白这是为什么。即使我没有在我的项目中添加任何 jar 文件。

【问题讨论】:

  • developer.sonymobile.com/2012/01/31/… 参考这个博客它可以帮助你减少你的android应用程序大小
  • 您检查过 apk 存档中的内容吗?可能包含了一些不需要的东西(缓存、备份、隐藏文件等)。
  • @asish 你能解决这个问题吗?
  • @Shobhit Nop,这对我来说仍然是个谜。

标签: android gradle android-studio apk android-gradle-plugin


【解决方案1】:

有 2 个构建变体,用于调试和发布。默认构建选项用于 Debug,它使大小变大。

检查这个答案: How to use the ProGuard in Android Studio?

【讨论】:

    【解决方案2】:

    清除项目并重新构建。检查原始资产文件夹。

    看看这个http://developer.android.com/tools/building/index.html

    【讨论】:

      【解决方案3】:

      如果存在较大的 png 文件,请尝试启用 AAPT 并使用下一个:

      android {
          …
          buildTypes {
              release {
                  crunchPngs true // or false
              }
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-11-15
        • 2015-05-14
        • 2013-12-19
        • 1970-01-01
        • 2021-04-23
        相关资源
        最近更新 更多