The Flutter app size is so big. How to reduce it? - flutter

Its starting app size is 17 MB. When developing the app, It's increasing the size from 17MB.
How to reduce the size of flutter given app (First project)
I used this method to get android app
flutter build apk --build-name=0.1 --build-number=2

According to the Official documentation of Flutter, they have various steps to analyze which part of your code is exactly taking much more space than needed.
They have a proper guide on that, to take you through analyzing the source code, testing the app size, and giving you the information of which file or dependency is taking more size and how much it is taking.
If you don't want to go through it, here are some common things by which it can reduce your app size.
Remove unused resources
Minimize resources imported from libraries
Compress PNG and JPEG files
Here's the official documentation if you want to read it.
Documentation Link

you can try the following
Compress PNG and JPEG files
reduce the use of container and replace them with SizedBox and Cards
Minimize resource imported from libraries
Remove unused resources
the fewer the screens the better
also you can split the apks while building it using this command
**flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
**
and always

Related

Deferred components to reduce app bundle size - Flutter

Whether the Deffered component in flutter reduces the app bundle size for play store upload?.
As the document saying
Flutter has the capability to build apps that can download additional
Dart code and assets at runtime. This allows apps to reduce install
apk size and download features and assets when needed by the user.
But the base apk will contain flutter lib. that will be around 9+ MB.

Increase in app size on adding mlkit in flutter

I recently added mlkit in my app for smile detection and then .abb size increased from 48mb to 185mb. How can i reduce this size...
Are you using a flutter plugin or a direct ML Kit dependency. You could try use app bundle to include only one arch in your app, or use dynamic feature to download the feature. If you could depends on Google Play Service, you could use the unbundled version which is only hundreds of KB in size: https://developers.google.com/ml-kit/vision/face-detection/android
Please refer to https://developers.google.com/ml-kit/tips/reduce-app-size to reduce your size of the android app. Also, 48MiB to 185MiB doesn't sounds right. The native android sdk is about ~20MiB even without any of the above optimization.

Flutter: How to know the size of a flutter plugin

Adding many plugins can increase Flutter Apps size too much. But sometimes I find two similar plugins and if I have to choose them based on lesser size, how would I do it?
I couldn't find any tools for checking its size.
Flutter has a tool for measuring your app size it's documented here.
But the TLDR is:
Run flutter build apk --analyze-size --target-platform=android-arm
Run flutter pub global run devtools --appSizeBase=apk-code-size-analysis_04.json or whichever name the output of the previous command json was.
That should give you a look like this.
And then you can explore how much space each package, asset or whatever thats inside your app occupies.

crosswalk in Ionic2 increases app size by 25 MB [duplicate]

I really hope I'm doing something wrong. I've added crosswalk to a project and have had some serious app size increase. To test I've done the following.
created a new ionic project
added my app code to /www/
added ngcordova and various plugins
Ran ionic build and drop the apk onto a Genymotion emulator. The app was very slow but had a app size of 8.01mb (once installed - checked with app manager).
Then I deleted the app from the emulator
Ran ionic browser add crosswalk
Ran ionic run android which installed the correct .apk on the emulator. On checking in manage apps the app size is now 79.36mb!!! Thats a 71mb increase! Most places say 20mb at most but 71mb!!!
Can someone tell me what I've done wrong?
When I added the Android SDK I did add all the tools ad platforms availabe in the SDK manager, did that have some effect?
If this isn's fixable it's a show stopper for me, which is a shame after spending weeks developing an app...
Please help!
I'm also running into that issue. Unfortunately using crosswalk will definitely increase your apk size. However, I found some way to at least reduce the apk size. For instance you could make use of the crosswalk lite. It may reduce your apk size for about 15 MB (see crosswalk lite).
You can also specify that you don't want to build the projects for two architectures (explained here).
Same problem here. I think promissed size of 20Mb is for the apk file which is compressed, you are looking at installed size on device.
You can check generated APK size on platforms/android/build/outputs/apk/ or platforms/android/ant-build/
I think the problem you're encountering though Crosswalk related, it's emulation related. I've tried emulators from both Android Studio versions and Genymotion. They both didn't work well for hybrid app testing.
My advice is to try Chrome Device Inspector along with actual device testing. I don't think anyone will argue that's the best way to ensure performance. AWS Device Farm is just one of many offerings that will spit out physical devices for testing. There's even services that let you outsource testing on different devices by real people, just can't think of the name of it right now...
My current favorite is Cordova Tools for Visual Studio Code, but it has been buggy for me lately.
However, I'm in the early stages of a fleet of Cordova apps and was alarmed at the overhead Crosswalk has. ~20MB extra to your APKs, and ~70MB to the installed size of your application. That's pretty alarming, considering the apps we use it with, with resource assets (images, etc.) are about 1/10th the size of this one plugin!
We have one app that has actually degraded with Crosswalk. My theory is that Crosswalk doesn't do a good job parsing non-standard HTML which is a core feature we have since we have XSLT transformed XML which winds up being non-standard HTML. Traversing it is extremely slow compared to the default WebView. We do a lot of manipulation with raw DocumentNode objects, so maybe that's it. That said, I'm so surprised that if it's slow traversing/appending HTML via vanilla JavaScript that these other apps are seeing performance gains!
I also learned last night there is Shared Mode with Crosswalk which allows multiple applications that use Crosswalk to share one instance.

Intel XDK - Set Splash Screen

I was trying to build an android apk using Intel XDK.I just want to know if there is an option to set the splash screen, icons, application title in some build properties file rather than choosing it everytime you build the apk.
In the current build system the build menu is the only way to specify these assets. However, each time you build your app it will reuse the assets you provided initially. If you create a new project you'll have to provide them again.
In the Cordova build option you provide these assets by specifying them in an intelxdk.config.xml file. This is probably closer to what you are looking for. In the next major release we'll also be providing a way to provide those directly in the XDK, rather than on-line, but only for Cordova build options. However, there will be more flexibility in how you provide those assets, which will be easier to explain once that version of the XDK "hits the streets."
Sorry, but company policy does not allow me to provide a release date. All I can say is that it will be coming in the near future.