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
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
Hello finally I finished developing my app using flutter it's was Depends on API data when I developing I was using my mobile to running it's doing good but when I need to output apk using communed
flutter build apk i'ts display but when make login to app using data from API i'ts not working but when do run app everything working good … what the problem ???
massages showing me when do build apk
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'... Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider-1.6.5\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses or overrides a deprecated A
PI.
Note: Recompile with -Xlint:deprecation for details.
Removed unused resources: Binary resource data reduced from 46KB to 37KB: Removed 20%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 413.1s (!)
√ Built build\app\outputs\apk\release\app-release.apk (19.3MB).
add on android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to
use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle...
1.2s Resolving dependencies... 3.7s registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask
is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use
registerGeneratedResFolders(FileCollection) Running Gradle task
'assembleRelease'...
Running Gradle task 'assembleRelease'... Done
140.3s (!)
Gradle task assembleRelease failed with exit code 1
Try this:
flutter build apk --split-per-abi
Read document for more information
Over time, android has spread throughout the world and runs on more than 2 billion devices. Because of android running on multiple platforms and foam-factors, it is very important to make sure an optimised app is installed on each platform.
For eg., a phone which doesn't have a high-resolution screen, should not get high-res images and thus reduce the size of the APK.
To make sure your app is optimized for each platform, android provides 2 methods:
You can split your app into multiple APKs optimized for each platform.
flutter build apk --split-per-abi
Create an app-bundle and deploy it to play store, this way when a user downloads your app, play store automatically extracts and provides the APK which is optimized for that device.
flutter build appbundle --target-platform android-arm,android-arm64
Best way I found
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
I am new to flutter programming and I've created a demo app, its running fine on both android and iOS devices. I want to see .apk and .ipa file in flutter. Can anyone help me to get these files from Flutter? Where can I see these files in folders or is there any other solution.
For apk (Android) you need to run the command :
flutter build apk --release
If you want to split the apks per abi (Split Apk) then run
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
For ipa (iOS) you need to run the command :
flutter build ios --release
From the console
P.S. --release is optional as it is by default
if you need debug build, just replace --release with --debug
you can find the released APK or IPA files form
build/app/outputs/flutter-apk/app-release.apk
For Android an APK is generated every time you build the app, e.g. with flutter run. You will find that in your project folder under <project>/build/app/outputs/apk/debug/app-debug.apk. If you want a release APK, have a look at the docs.
I'm not an iOS person, so I'm not sure an IPA is generated during development as in android. But looking at these docs it seems you can follow the standard steps on xcode to get it, as shown here.
For apk (Android) run the command :
flutter build apk --release
For ipa (iOS) run the command :
flutter build ios --release
Then to get actual .ipa file, open xcode -> Product -> archive -> Distribute App -> Ad Hoc -> Export
You can then save the .ipa(which is inside the Runner folder) file in any location
I also had this question and had a really tough time finding the right solution.
First of all in the terminal of your code editor type:
flutter build apk --release
and after that go to this location:
yourAppFolder/build/app/outputs/apk/release/app-release.apk
I do not do development for iOS so I don't know much about that.
For Android, an APK is generated every time you build the app, e.g. with flutter run. You will find that in your project folder under <project>/build/app/outputs/apk/debug/app-debug.apk.
Follow below steps to get .apk and .ipa from flutter app in Mac system
First, Enter below command in your terminal to go your project directory
cd $(PROJECT FOLDER PATH)
For android apk build to upload store, Enter below command
sudo $(FLUTTER SDK PATH till bin)/flutter build apk --release
To get ios ipa , Enter below command
sudo $(FLUTTER SDK PATH till bin)/flutter build ios --release
To get an apk, it is simple. Just use :
flutter build apk
To get an ipa, It is more complicated. First use :
flutter build ipa
Be careful to use flutter build ipa, not flutter build ios, because the second one builds a ".app" file instead of ".xcarchives" file.
Once you have the ".xcarchives" file, you can open it in XCode and click on "Distribute the app" to export an ipa file on your computer.
For iOS:
Step 1: open terminal and type cd "your flutter sdk path"
Step 2: cd export PATH=/Users/yourname/Downloads/flutter/bin:$PATH
Step 3: cd your project path
Step 4: flutter build ios --release
run step 1 to 4 in terminal.
After that open android studio and go to iOS folder path and open project.pbxproj file with ios module and in xcode you need to choose generic ios device and select archive, it will generate ipa build for you.
Android(After adding release build type run below command which will generate release apk with below version)
flutter build apk --build-name=1.0.1 --build-number=1
iOS
flutter build ios --release
For a detail explanation read the below article.
https://medium.com/#ralphbergmann/versioning-with-flutter-299869e68af4
For apk, you can use flutter build apk --release to get the release version of your apk on either windows/macOS.
For ipa, you have to use flutter build ios --release to get the release version of your apk on macOS.
Note: You can get a ipa on macOS only.
If you want this apk and .ipa with flavour then you can refer below commands for internal and production.
iOS:
flutter build ios --debug --flavor internal
flutter build ios --release --flavor production
android:
flutter build apk --debug --flavor internal
flutter build apk --release --flavor production
Updated for iOS :-
first you need to go to your current working directory and run the following command;
flutter build ios --release
After successfully completion of build, you can find build on below path;
/Users/sanjaybalaji/Documents/KiranFlutterApps/hb_calculator/build/ios/iphoneos/Runn
er.app.
you can check below screenshots for more details.
You can find your app apk after you run the app at path
<project_dir>/build/app/outputs/flutter-apk/app.apk