小编Tba*_*aut的帖子

React Native:将 minSdkVersion 从 21 更改为 23 使应用程序 apk 大小增加了一倍

由于库兼容性,我不得不将 minSdkVersion 从 21 提高到 23。我意识到这样做,并且仅更改此设置,我生成的 apk 大小就增加了一倍多。它从~35MB 增加到~90MB。

使用 Android studio 构建应用程序会导致相同的行为。使用 Android studio 的 apk 分析器,将其与 minSdkVersion 21 的版本进行比较时显示如下:

在此输入图像描述

看起来以前的版本lib也一样大(79.9MB),但是以前的版本以某种方式设法减小了 apk 的大小。

因为我将应用程序作为 apk 分发,并且在 Android 商店中分发,所以 apk 大小很重要。非常感谢您的任何提示。

编辑,以防带来一些东西,这里是 ny android/app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as …
Run Code Online (Sandbox Code Playgroud)

android react-native

6
推荐指数
1
解决办法
2725
查看次数

标签 统计

android ×1

react-native ×1