【问题标题】:Build NativeScript Blank Project with Minimum Size构建具有最小大小的 NativeScript 空白项目
【发布时间】:2019-10-07 06:37:53
【问题描述】:

我想构建一个尽可能小的 apk 文件(它是一个空白项目),

here 所述:可以通过从<Project>/platforms/android/libs/jni/ 中删除不必要的ABI 相关库文件夹 来完成,

我的问题是:在<Project>/platforms/android 目录中,我只有这些文件夹: appbuild-toolsgradle

我该怎么办?

现在我的 APK 文件大约 28MB,像 12MB 这样的大小对我来说会很好。

我想用 JS 写一个非常简单的应用程序(--没有框架),我想保持尽可能小的尺寸。

【问题讨论】:

    标签: nativescript


    【解决方案1】:

    Android App Bundle 现在是 Google 推荐的创建单个文件的方法,该文件将仅分发用户设备所需的架构。我推荐它,因为它比使用 ABI 拆分生成的多个 APK 更容易维护单个文件。

    Here is an article 了解如何在 NativeScript 中创建 Android App Bundle。

    【讨论】:

      【解决方案2】:

      这是 3 年前的文章。它已被更新。你应该检查这个问题:https://github.com/NativeScript/android-runtime/issues/518

      【讨论】:

        【解决方案3】:

        将文件 <Project>/app/App_Resources/Android/app.gradle 编辑到:

        android {
          defaultConfig {
            generatedDensities = []
            applicationId = "org.nativescript.testapp"
        
            ndk {
              abiFilters.clear()
            }
          }
        
          splits {
            abi {
              enable true //enables the ABIs split mechanism
              reset() //reset the list of ABIs to be included to an empty string
              include "x86", "armeabi-v7a", "arm64-v8a", "x86_64"
              universalApk true
            }
          }
        }
        
        

        解决了我的问题,新大小约为 10MB,非常棒。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-02-04
          • 1970-01-01
          • 2012-04-19
          • 1970-01-01
          • 2018-10-15
          • 1970-01-01
          • 2011-08-07
          相关资源
          最近更新 更多