My apk weighs 150 mb, is there any way to reduce this? - flutter

I've been working on my flutter app for about two months now and the size was around and average 0f 30 - 35 mb when compiling an apk, recently I added the flutter jitsi_meet 1.0.0 dependency and now when I compile an my apk size turns out to be 156 mb.
Is it posible that the dependency is that heavy?
and if so, Is it posible to reduce it?
I ran their main.dart example and then compiled it and turn out to be 98 mb on a fat apk.

this plugin uses video handing thing this is why size increased. use split APK run this command
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi

First, run this command
flutter clean
Then the build command

Please check your release mode app size for that run below two commands on your terminal.
1. flutter clean
2. flutter build apk
Also, Google Play allows us to upload multiple apks, e.g. one per every architecture.
flutter build appbundle
Follow the instruction here: https://flutter.dev/docs/deployment/android#building-the-app-for-release

Related

Flutter APK size it's greater than 150mb

i'm having some problems while compiling my flutter app for Android.. I've only 3 assets and a couple packages added, but when I try to compile, I got this:
√ Built build\app\outputs\flutter-apk\app-release.apk (158.3MB).
Any idea?
Flutter build log (running flutter build apk)
PS C:\\Users\\Admin\\Desktop\\Fictix\\Don't Touch This\\app\\dtt_app\> flutter build apk
Building with sound null safety
First of all, you can try clearing the cache via terminal.
flutter clean
This command will delete few temporary folders, specially "build/", ".dart_tools/" and ".packages/".
You can also run the following code from the terminal before the build phase of your application.
flutter build appbundle --target-platform android-arm,android-arm64
Of course, it is not a 100% method, but it can work in reducing your application size.
You can follow the steps below to clear it by Android Studio.
Tools > Flutter > Flutter Clean
Make your app with no sound null safety
From Terminal Run This Command
flutter build apk --split-per-abi --no-sound-null-safety
or
flutter build apk --release --no-sound-null-safety
If your problem still persists
// #2.9 in the top remove the parameter from Const app_name();
Run --no-sound-null-safety from terminal
Edit your Configure File and write in Additional run args:- --no-sound-null-safety

Flutter apk file building taking huge time

I am using Android Studio to run Flutter. I have 8GB RAM, 256GB SSD. But whenever I am going to generate an apk file, it's taking an unlimited time. I have tried all possible command like:
flutter build apk --release
flutter build apk --split-per-abi
flutter build apk --build-name=1.0 --build-number=1
But still, the apk is not generating. It is showing:
Building with sound null safety
`Running Gradle task 'assembleRelease'...` \
What should I do?
I have found something interesting here. After commanding mentioned command, if I do not close the terminal it's building nonstop. But if I close the terminal and let it go doing my other work, it executes very quickly. I do not know why, but it happens several times here for me.
first use this command
flutter clean
and then
flutter build apk --split-per-abi
this command is enough for generating all type apk

Suddenly the apk size increase from 24 mb to 88 mb

I had used flutter build apk more than 20 times and it size was 24 mega byte
but now suddenly it is 88 mega byte in release mode
can anyone tell me why that happen
note : the assets file is 4.9 mega byte
note : i don't have any videos or gif in my app
Have you added any new dependencies since your last release build?
I assume you built a universal APK. This type of APK contains all the files that are required for all types of CPU. This also makes the APK very large.
Try running flutter build apk --split-per-abi. This will create a seperate APK for the different CPU types.

how delete architecture in flutter apk

I'm making an app on flutter(i'm a rookie on this language), and i see on the lib folder of the app 6 architectures x86, x86_64, mips, armeabi, armeabi-v7a, arm64_v8a but to upload on the playstore just need 2 armeabi-v7a and arm64_v8a. my question is, how can i compile the app without the other 4 architectures to reduce the size of the app because with the 6 folders it is 140MB?
p/s: English is not my natural lenguaje
Looks like you're only doing flutter build hence, you're getting so many builds.
Here's what you can do,
if you're building for a play store, the recommended way to do is by building an appBundle which you can refer how to here
you can try flutter build apk --split-per-abi which will produce only 3 versions arm64-v8a, armeabi-v7a and x86 so you can extract the two and upload.
Additionally, you can build for only specific platforms by using this command
flutter build apk --target-platform android-arm64,android-arm --split-per-abi
refer this for more information on splitting.
in ../android/app/build.gradle add the lines
android {
...
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
}
built for all architectures by default

What is difference between app.apk and app-release.apk

After running flutter clean and flutter build apk --release
I have two apks in build/app/outputs/flutter-apk. app.apk and app-release.apk.
What are their differences as I see both have the exact same size?
I think nothing.
app.apk can be equal to app-release if your last build was --release, otherwise app-debug if your last build was --debug.