Flutter apk file building taking huge time - flutter

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

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

APK building failed in flutter

I've been trying to build an apk for my app but its failing and I don't understand why
this is what is shwoing
i tried to build using this command that was given to me in comments
flutter build apk --no-tree-shake-icons
but its showing me this new error now
Try add this when build your apk --no-tree-shake-icons
Generally, for errors that seem odd like this, running flutter clean then flutter pub get in the terminal helps.

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.

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

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

how to build apk create old version app in Flutter

I am trying to build my release app in Flutter and when I run:
flutter run
everything works fine in debugging and test mode. But when I was trying to build a release app with:
flutter build apk
it creates an old first-release app of mine. That I created before and I try to reset the computer reset android and everything but not work what can I do to reset it and clear the cache?
I'm trying almost to delete and reset everything but they don't work.
What command that I have to run to fix it and create new version release apk
The solution is easy.
Just run flutter clean and run flutter build apk after that and it generates the updated app apk.
If you want to install it directly just run flutter install after the build command.
To all the beginners If you wish to release an apk of a flutter app just do:
flutter run --release
(and make sure to connect your device to a phone)
steps to ensure your phone is connected:
1. enable usb debugging mode in your phone
2.click on version number of your phone in system settings to enter into developer mode
3. change the phone mode to transferring file mode
After you run the command
go to build->apps->output->apk
run these command
flutter clean
and after that
flutter build apk --release
Run this command for making a bundle.
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
If flutter clean and flutter build apk also generates apk with old version code in your pubspec.yaml change the version like this version: 1.0.2+2
Before + it is your version name and after + sign it is your version code
NOTE: Your new version number should be in the place of 2. Or you can use different format such as 1.2+2
You can run flutter clean Then run flutter build apk --split-per-abi to split the apk. It will build three apks and you can find them in build/app/outputs/flutter-apk/
Can be done easily by Android Studio