简体   繁体   English

android 包大小比通用 apk 大得多

[英]android bundle size much bigger than in universal apk

When I built universal apk it size was 170mb.当我构建通用 apk 时,它的大小为 170mb。 After I implemented extension files (due to the large asset folder) I have to build bundles.在我实现扩展文件后(由于资产文件夹很大),我必须构建包。 But the bundle size is much bigger - 283mb.但是包的大小要大得多 - 283mb。 Uppon unzipping aab file I see, that just lib folder weights 150mb.解压缩 aab 文件后,我看到只有 lib 文件夹重 150mb。 And includes extra architectures which are not present in config (like mips)并包括配置中不存在的额外架构(如 mips)

  splits {
    abi {
      enable true
      reset()
      include 'x86', 'armeabi-v7a', 'arm64-v8a'
      universalApk false
    }
  }

Thre is split of folder sizes, where libraries ar emostly c++ libs.文件夹大小有分裂,其中库主要是 c++ 库。

在此处输入图片说明 What can be done to mitigate such increase as playmarket only accept bundle with 150mb and lower (not including asset-delivery size)可以做些什么来减轻这种增加,因为 playmarket 只接受 150mb 及以下的捆绑包(不包括资产交付大小)

Code analysis can help find unnecessary code.代码分析可以帮助找到不必要的代码。 Analyze -> Inspect Code... -> Whole project.分析 -> 检查代码... -> 整个项目。 That can clean up some space.那可以清理一些空间。 If you have dependencies that are large, you can replace them with smaller dependencies, but you will need to rewrite code.如果您有很大的依赖项,您可以用较小的依赖项替换它们,但您需要重写代码。

You can ask gradle to reduce the size of dependencies:您可以要求 gradle 减少依赖项的大小:

android {
    // Other settings

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Here is a link about reducing apk size:reduce-apk-size这是关于减少 apk 大小的链接:reduce-apk-size

and another: shrink code另一个:收缩代码

Most of it is added with the code above.大部分是用上面的代码添加的。

App Bundle size is not a direct indication of how big it will be the download for the users. App Bundle 大小并不能直接表明用户的下载量有多大。 Also the 150MB limit is the compressed download size limit .此外,150MB 限制是压缩下载大小限制

You should upload your App Bundle and use Play Console's App Bundle Explorer to double check the size of the downloads.您应该上传您的 App Bundle 并使用 Play管理中心App Bundle Explorer仔细检查下载的大小。
Google Play Store implements many optimizations to reduce downloads when it delivers application from and Android App Bundle. Google Play 商店在从 Android App Bundle 交付应用程序时实施了许多优化以减少下载量。

You can find more information in the documentation: https://d.android.com/appbundle您可以在文档中找到更多信息: https : //d.android.com/appbundle

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

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