I need to build release apk I have see another answer I run this command in my terminal
flutter build appbundle --target-platform android-arm,android-arm64
it's showing this Built build\app\outputs\bundle\release\app-release.aab
Its not apk file? I need release build apk so can upload on play store
You can just run flutter build apk to generate release apk.
Have a look at this page for more information.
Also, appBundles can also be uploaded to the Play Store, so the .aab file is absolutely fine :D
No worries, you can upload the .aab file just as well.
In fact, this is the recommended way - read here why this is the case: https://developer.android.com/guide/app-bundle.
You can run "flutter build apk --split-per-abi", so that it will give a separate release APK for each target platform.
Related
I was developing a flutter application. So I had to delete unused assets used in the project(mainly images) to reduce app size. How can we achieve this in a better way?
Check out this tutorial by the Flutter team for information on how to reduce app size.
When you release app as appbundle it reduces by every architechture that's why you do not need doing this proccess.It would we automatically changed when user download apk from google play
You can try delete unused packages and it would be good too for size app.
When you run flutter build apk or flutter build apk --release app size very high when you try run this flutter build apk --split-per-abi app size will be reduced by architechture of processor. When you upload your project to store it will be required appbundle that why when you download app really from store it would show to reduced size app that's why dont worry.
I couldn't install flutter app on my android phone. How can I do it? I can run by usb debugging However I want to install it on my phone. Can someone help me please?
If you use IntelliJ Idea (it should also work on Android Studio), you can go to
Build -> Flutter -> Build APK, (in the menu bar)
and after building, your apk will appear in
build/app/outputs/flutter-apk/app-release.apk,
just send the file to your phone and install, your phone will probably tell you not do download cause it isn't checked and secured or something, just ignore and install anyway
Connect your Android device to your computer with a USB cable.
Enter cd [project].
Run flutter install.
Source: here
You need to build the app to get the apk. For building apk use this command in console: flutter build apk and if you want to build your apk in smaller size then use this command in console: flutter build apk --split-per-abi.
After building apk you will find it in [project]\build\app\outputs\flutter-apk\app-armeabi-v7a-release.apk here.
If you don't want to build apk and just want to test your app you can run it in profile mode by using this command in console: flutter run --profile.
In android studio under the tools-> build -> build apk will create and app for you and you can get and the output location will show you after the builing the app
I find little to no information on what's the difference between these two
flutter build bundle
flutter build appbundle
When should I use one over the other?
flutter build appbundle
builds the 'app bundle' that is uploaded to the Google Play store. The app bundle is basically a bundle of apk files. When a user installs your app, Google Play will serve the optimal apk to the device. The app bundle is compressed into a aab file (Android app bundle).
flutter build bundle
builds a special 'app bundle' archive from the list of assets in your pubspec.yaml that your app can read from at runtime. The builder places this in the flutter_assets folder in the build directory.
So basically they build different stuff. flutter build appbundle is pretty much unavoidable if you're building an app for release on the Play Store.
However, I have never needed to use flutter build bundle. I have never needed to build an individual assets folder as it's incorporated within an appbundle build.
While trying to build flutter ios app for release I am getting this error every time
Failed to find snapshot: /var/containers/Bundle/Application/19D78607-A03B/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin
I have tried these things to correct it but failed
running flutter clean and then flutter run --release
changing flutter channel to beta and master
deleting build folder and then flutter clean and flutter run --release
flutter clean > flutter build ios > archive in Xcode to test on the test flight
Does anyone know how to fix it?
I've been seeing this issue frequently over the last few days. I recreated my ios directory which fixed the issue temporarily, but it came back.
What I learned is that it is expected that kernel_blob.bin is not present in release builds, because that file contains your Dart sources in bytecode form ready for JIT, but release builds don't use JIT, they use AOT and your Dart files are compiled into a binary that is placed under App.framework. Rather, this error happens because the release build of the app is incorrectly incorporating the debug (i.e. JIT) version of the Flutter engine.
The best solution I've found so far is to move the build folder to the trash (flutter clean is not working and hangs indefinitely on deleting the build folder for some reason), run flutter clean, run flutter build ios --release from the command line first, then (in my case) create the archive in Xcode.
Run flutter doctor -v
I have resolved this problem, if someone happened, you can try this.
Remove Flutter.framework, build again. Make sure Flutter.framework and App.framework are the same debug or release mode.
Run the following from a terminal, this removes "ios/Flutter/App.framework" and everything underneath it:
rm -rf ios/Flutter/App.framework
and then rebuild your app from xCode. This solved this problem for me.
By multiplatform I mean arm64 and arm, using the default way of build a release apk it gives me an apk that works only on arm, but I can make an arm64 version by using the command
flutter build apk --release --target-platform --android-arm
The question is, how to make 1 apk for both platform or an app bundle that will work for play store?
I think is by using:
flutter build appbundle
Currently, if you're uploading an APK to the play store you need to upload multiple APKs for the architectures you're specifically targeting. You're able to create a "fat APK" which contains all the architectures however, it will increase the overall APK size.
As per the docs, it's recommended to use the app bundles as it will provide the required architecture depending on the device that downloads the app.
More info here: https://flutter.dev/docs/deployment/android
use this command in terminal ->flutter build apk --split-per-abi