带有ionic 4 build的apk大尺寸 [英] apk big size with ionic 4 build

查看:43
本文介绍了带有ionic 4 build的apk大尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我得到输出之前,它是 9 兆字节.
但现在是 17.8MB.
我使用分析 apk 在 android studio 中打开了 apk.
资产文件夹非常大,每个文件都有几个数字.

Before I got the output, it was 9 megabytes.
but now it is 17.8MB.
I opened apk in android studio with Analyze apk.
assets folder is very big and there are several numbers from each file.

离子信息:

Ionic:

ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework               : @ionic/angular 4.0.0-rc.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics    : 7.1.4
@angular/cli                  : 7.1.4
@ionic/angular-toolkit        : 1.4.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms     : android 7.1.4
Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.1, (and 16 other plugins)

System:

Android SDK Tools : 26.1.1 (/home/omid/programming_tools/android-sdk)
NodeJS            : v10.15.0 (/usr/local/bin/node)
npm               : 6.8.0
OS                : Linux 4.20

我使用这个命令:

ionic cordova build android --prod --release

ionic cordova build android --prod --release

发生了什么?

推荐答案

这是 ionic 4 中的一个巨大缺陷.我建议遵循以下构建说明:

This is a massive flaw in ionic 4. I recommend following these build instructions:

测试 APK:

从项目中删除www"文件夹

Delete 'www' folder from project

ionic cordova build android --minifycss --optimizejs --minifyjs

生产APK:

从项目中删除www"文件夹

Delete 'www' folder from project

ionic cordova build android --minifycss --optimizejs --minifyjs --release --prod

理论上 --minifycss --optimizejs --minifyjs 都是由 --prod 应用的,但你永远不知道 Ionic

In theory --minifycss --optimizejs --minifyjs are all applied by --prod but you never know with Ionic

这篇关于带有ionic 4 build的apk大尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆