Can anyone tell me how do I reduce this apk size?
Some major contributors are classes.dex(3MB), Dart AOT symbols(6MB) and audience_network.dex(1MB).
The same applicative using native android can be built in just 4-5MB
Here are the results of --analyze-size.
C:\Users\arunc\AndroidStudioProjects\bonaza>flutter build apk --target-platform android-arm64 --release --analyze-size
Running "flutter pub get" in miband5... 1,807ms
Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety\
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\permission_handler-5.0.1+1\android\src\main\java\com\baseflow\permissionhandler\PermissionHandlerPlugin.java u
ses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 124.9s
√ Built build\app\outputs\flutter-apk\app-release.apk (12.5MB).
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
app-release.apk (total compressed) 13 MB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
res/
drawable-anydpi-v21 8 KB
interpolator 1 KB
drawable-xxhdpi-v4 56 KB
drawable-hdpi-v4 33 KB
drawable 21 KB
drawable-anydpi-v24 2 KB
drawable-mdpi-v4 24 KB
color-v23 2 KB
drawable-xhdpi-v4 40 KB
drawable-ldpi-v4 6 KB
color 5 KB
mipmap-hdpi-v4 19 KB
layout 28 KB
anim 8 KB
drawable-xxxhdpi-v4 48 KB
mipmap-xxxhdpi-v4 88 KB
mipmap-xhdpi-v4 29 KB
mipmap-xxhdpi-v4 55 KB
drawable-ldrtl-xxxhdpi-v17 2 KB
mipmap-mdpi-v4 10 KB
drawable-v21 2 KB
drawable-ldrtl-xhdpi-v17 1 KB
drawable-ldrtl-xxhdpi-v17 1 KB
layout-watch-v20 1022 B
layout-v21 2 KB
META-INF/
CERT.SF 36 KB
kotlin-stdlib.kotlin_module 1 KB
MANIFEST.MF 32 KB
CERT.RSA 1 KB
assets/
flutter_assets 69 KB
audience_network.dex 1 MB
kotlin/
kotlin.kotlin_builtins 4 KB
reflect 2 KB
collections 1 KB
AndroidManifest.xml 6 KB
classes.dex 3 MB
resources.arsc 664 KB
lib/
arm64-v8a 6 MB
Dart AOT symbols accounted decompressed size 6 MB
package:flutter 3 MB
dart:core 405 KB
dart:typed_data 273 KB
dart:io 253 KB
dart:ui 215 KB
dart:async 173 KB
dart:collection 165 KB
package:miband5 152 KB
package:parse_server_sdk 122 KB
package:flutter_gen 122 KB
package:flutter_localizations 106 KB
package:flutter_cache_manager 102 KB
dart:convert 83 KB
package:sqflite_common 73 KB
package:source_span 63 KB
package:win32 53 KB
package:intl 50 KB
dart:isolate 39 KB
package:vector_math 34 KB
package:google_mobile_ads 29 KB
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
A summary of your APK analysis can be found at: C:\Users\arunc.flutter-devtools\apk-code-size-analysis_09.json
run flutter clean
run flutter pub get
run flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
after running third commmand you'll get seprate apk's for android-arm , android-arm64 , android-x64 which reduces the apk's size.
Related
I have Centos installed on a server with 64gb memory and it seems as if the memory usage is being suppressed.
I came to this conclusion by running an insert statement where I insert 10million rows into a Postgres table in both a Timescaledb and a standard Postgres instance hosted on Docker.
I monitored the insert process in three different ways:
Docker stats timescaledb:
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
timescaledb 73.14% 10.42 MiB / 62.75 GiB 0.02% 8.46 kB / 8.39 kB 0 B / 15.1 GB 12
free -i gives the following:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16298 avahi 20 0 16.2g 762356 759908 R 41.5 1.2 0:22.72 postgres
16127 avahi 20 0 16.2g 693080 691968 S 4.3 1.1 0:01.29 postgres
16129 avahi 20 0 16.2g 17748 16712 S 2.3 0.0 0:00.87 postgres
1578 root 30 10 1232780 86976 11568 S 0.7 0.1 0:46.34 osqueryd
17014 root 20 0 162264 2480 1596 R 0.7 0.0 0:00.03 top
928 root 20 0 90608 3212 2352 S 0.3 0.0 0:03.47 rngd
16128 avahi 20 0 16.2g 132064 131016 S 0.3 0.2 0:00.18 postgres
free -h gives the following
total used free shared buff/cache available
Mem: 62G 1.0G 58G 1.1G 3.1G 56G
Swap: 62G 0B 62G
I know that Timescaledb is an extension of Postgres which comes with its own memory configurations, but the Docker container of Timescaledb configures these automatically for you (for instance effective cache size is set at 48gb as opposed to the default 4gb that Postgres ships with). I also ran a similar process with Apache spark with 16gb assigned to the worker and it ran into an oom error. Additionally, I did a similar test on a different smaller VM and the memory usage increased as expected. All of this leads me to believe that it's a Centos config setting that I am missing somewhere, and nothing to do with Timescale/Postgres?
I have added the following parameters to vm.overcommit_memory = 2 and vm.overcommit_ratio = 95 in /etc/sysctl.conf and ran sysctl -p to implement the settings, but this didn't make a difference.
kernel.shmall = 8224280
kernel.shmmax = 33686650880
kernel.shmmni = 4096
vm.overcommit_memory = 2
vm.overcommit_ratio = 95
Below is the output from cat /proc/meminfo
MemTotal: 65794240 kB
MemFree: 61098656 kB
MemAvailable: 59252660 kB
Buffers: 2120 kB
Cached: 3467144 kB
SwapCached: 0 kB
Active: 2817620 kB
Inactive: 884816 kB
Active(anon): 1109220 kB
Inactive(anon): 234708 kB
Active(file): 1708400 kB
Inactive(file): 650108 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 65535996 kB
SwapFree: 65535996 kB
Dirty: 88 kB
Writeback: 0 kB
AnonPages: 233188 kB
Mapped: 1175120 kB
Shmem: 1110756 kB
Slab: 204044 kB
SReclaimable: 142700 kB
SUnreclaim: 61344 kB
KernelStack: 7232 kB
PageTables: 14672 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 128040524 kB
Committed_AS: 18709300 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 408824 kB
VmallocChunk: 34325399548 kB
Percpu: 9216 kB
HardwareCorrupted: 0 kB
AnonHugePages: 96256 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 133604 kB
DirectMap2M: 66965504 kB
Is there maybe something I can try to increase my memory usage? Is there maybe a config setting that I am missing somehere?
Thanks in advance for any help
PostgreSQL also uses "unused" memory, because it uses buffered I/O. So this "unused memory" is used by the kernel to cache files – in the case of a database server, these will be database files. That way, I/O requests by PostgreSQL can be served from the kernel cache rather than causing disk I/O requests.
I'm working on my flutter app, and the most recent size report I got is: 219 MB,
by running this command:
flutter build apk --analyze-size --target-platform=android-arm64
clearly, 219 MB size is TOO BIG for me, although I did checked out some tutorials online to reduce the app size, but none of seem effective, so I decided to REALLY dive into this topic, and here are my questions:
Does adding more packages to my app really increase my app size?
If the packages are the same, but I import them to more files, does that effect my app size?
If I increase my widgets and screens, does that increase the app size?
If numbers of widgets are the same, but I sperate (extract widget) them into different files, will the app size increase?
Does the app size that the command returns (above) really reflect my app size in the real world when I publish it?
What are the factors of app size (numbers of widgets, files, or packages)
And here is the analysis:
✓ Built build/app/outputs/flutter-apk/app-release.apk (219.5MB).
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
app-release.apk (total compressed) 219 MB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
res/
interpolator 1 KB
drawable-hdpi-v4 21 KB
drawable-xxhdpi-v4 33 KB
drawable 16 KB
drawable-xhdpi-v4 25 KB
drawable-mdpi-v4 16 KB
drawable-xxxhdpi-v4 26 KB
color-v23 2 KB
color 3 KB
anim 8 KB
layout 21 KB
drawable-anydpi-v21 2 KB
drawable-ldrtl-xxxhdpi-v17 2 KB
layout-v21 2 KB
drawable-v21 2 KB
drawable-ldrtl-xhdpi-v17 1 KB
drawable-ldrtl-xxhdpi-v17 1 KB
layout-watch-v20 1020 B
mipmap-xxxhdpi-v4 1 KB
raw 1 MB
META-INF/
CERT.SF 34 KB
kotlin-stdlib.kotlin_module 1 KB
CERT.RSA 1016 B
MANIFEST.MF 31 KB
lib/
x86 45 MB
armeabi-v7a 58 MB
arm64-v8a 59 MB
Dart AOT symbols accounted decompressed size 8 MB
package:flutter 3 MB
package:cheese 605 KB
dart:core 389 KB
package:rive 320 KB
dart:io 278 KB
dart:typed_data 265 KB
dart:ui 247 KB
dart:collection 189 KB
dart:async 177 KB
package:flutter_svg 143 KB
package:just_audio/
just_audio.dart 77 KB
dart:convert 76 KB
package:sqflite_common 70 KB
package:vector_math 66 KB
package:petitparser 65 KB
package:photo_view 59 KB
package:source_span 58 KB
package:xml 52 KB
package:cloud_firestore_platform_interface 51 KB
package:rxdart 46 KB
x86_64 52 MB
kotlin/
reflect 2 KB
collections 1 KB
kotlin.kotlin_builtins 4 KB
assets/
flutter_assets 237 KB
IAgoraMediaEngine.h 7 KB
AgoraBase.h 8 KB
IAgoraRtcEngine.h 85 KB
IAgoraRtcChannel.h 16 KB
google/
protobuf 21 KB
resources.arsc 405 KB
okhttp3/
internal 33 KB
AndroidManifest.xml 4 KB
classes2.dex 747 KB
classes.dex 3 MB
I have tons of widgets but I have no idea how to reduce any of them, so PLEASE HELP!!!
I have an app developed with Angular-CLI using Visual Code:
angular/cli: 9.0.3,
npm: '6.14.8',
ares: '1.16.1',
brotli: '1.0.9',
cldr: '37.0',
icu: '67.1',
llhttp: '2.1.3',
modules: '83',
napi: '7',
nghttp2: '1.41.0',
node: '14.15.0',
openssl: '1.1.1g',
tz: '2020a',
unicode: '13.0',
uv: '1.40.0',
v8: '8.4.371.19-node.17',
zlib: '1.2.11'
I have been compiling and running my app for years with no problems and suddenly after a successful compile:
$ ng serve
chunk {main} main.js, main.js.map (main) 6.16 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 233 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 1.1 MB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.58 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 13.9 MB [initial] [rendered]
Date: 2020-11-05T17:58:57.468Z - Hash: fc25bd5314199aca3ed8 - Time: 56147ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.
the application hangs and I get the following error message in the browser inspector:
Uncaught TypeError: Cannot read property 'NODE_DEBUG' of undefined
at Object../node_modules/util/util.js (util.js:109)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/bl/bl.js (bl.js:3)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/msgpack5/index.js (index.js:5)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/autobahn/lib/autobahn.js (autobahn.js:22)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/autobahn/index.js (index.js:14)
at __webpack_require__ (bootstrap:79)
I am sorry I cannot give you more details but I am really clueless. A google search does not even produce a meaningful link to follow to try to fix the problem. I wonder if someone has stumbled on the same problem and can direct me in the right direction.
Right, after running an "ng build" I found warnings about crypto-js library.
I had to install crypto-js V3.3.0 to have my app working again. latest release of the library will not work.
Hope this will help someone but if you can explain why this worked feel free to add to my answer.
I am struggling to de-allocate from a Pillow Image.
If I run the following:
#profile
def do_image_things():
im = Image.open(foo.png')
im.close()
del im
Then I get the following output from Python's memory_profiler:
Line # Mem usage Increment Line Contents
================================================
8 33.645 MiB 33.645 MiB #profile
9 def do_image_things():
12 37.383 MiB 3.738 MiB im = Image.open(u'foo.png')
13 37.387 MiB 0.004 MiB im.close()
14 37.387 MiB 0.000 MiB del im
The im.close() call appears not to have de-allocated the memory that the Image.open() reserved. The is a bare-bones reproduction of an issue occurring in a large-scale image processing deployment that we've noticed memory problems in.
Has anyone been able to resolve this problem?
I'm running Pillow Version 5.0.0 and 2.7.14 on Mac OS X.
I have an ahk script I use to enable the Printer button on a Crystal Reports dialog that for what ever reason is not enabled by default when used in Server 2008 R2. Anyways... the issue I am having is the process when running continues to stack memory each cycle. Its not like I am storing any contents to a variable that happens to not get cleared. What in this process uses memory resources that don't get released and is there anything I can implement to prevent this from happening?
You can see in this listing that the private memory just grows as usage goes on. I ended up having it initiate about 5 times and it went from about 1000k to 2000k.
The top entry is my test version I converted from WinWaitActive that was causing unnecessary CPU usage.
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
58 8 2312 6216 68 0.62 7828 showprinterbutton
55 8 1788 5508 67 32.39 6840 ShowPSPrinter
57 8 1864 6028 79 33.12 7184 ShowPSPrinter
55 8 1396 5084 67 1.29 7604 ShowPSPrinter
55 8 1796 5536 67 36.36 7856 ShowPSPrinter
55 8 1772 5444 67 37.27 9848 ShowPSPrinter
55 8 1740 5424 67 26.33 10300 ShowPSPrinter
55 8 1396 4992 67 0.84 11348 ShowPSPrinter
55 8 1396 5024 67 1.14 11460 ShowPSPrinter
55 8 1736 5604 67 355.93 11676 ShowPSPrinter
55 8 1396 4984 67 1.06 13364 ShowPSPrinter
55 8 1396 5132 67 0.81 13516 ShowPSPrinter
72 9 2048 6500 73 66.36 14072 ShowPSPrinter
55 8 1792 5504 67 59.92 15736 ShowPSPrinter
55 8 1400 4960 67 0.61 16340 ShowPSPrinter
57 8 1496 5848 79 0.98 18516 ShowPSPrinter
57 8 1500 5404 79 0.98 19048 ShowPSPrinter
55 8 1400 5000 67 0.51 22020 ShowPSPrinter
Here is the script contents I have that is then compiled to run as an EXE.
; Version: 1.2
; Dated: 03/31/2015 - Created
; Description: Enable a watch for page setup dialog and activate the print button for crystal reports
; Only allow one instance to run
#SingleInstance force
; Run with out a tray icon
#NoTrayIcon
; Getting loose with not requiring direct title menu values
SetTitleMatchMode, RegEx
; Start active watch for quick post menu
WaitForPS:
WinWait,Page Setup
{
Control,Show,,Button8,Page Setup,(optimize for screen display)
GoSub WaitForPS
}
; End of Script...
Right after the moment the window appears and the loop ran one time, WainWait immediately continues to the next statement because the window already exists, enables the control, and recursively invokes the loop again (gosub), so the code allocated for example 100 stack frames per second thus eventually exhausting the call stack.
Instead use an indefinite loop and before continuing wait for the window to close:
Loop
{
WinWait,Page Setup
Control,Show,,Button8,Page Setup,(optimize for screen display)
WinWaitClose
}