Flutter - Build and Release an Android App | App Signing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you took the time to code your app implemented all the features or maybe it is just an mvp now you want to release it to the public but you don't know exactly how if this is your case you came to the right place in this video i will show you how to prepare and build your floater app for projection release on android we will do the same for ios in an upcoming video when you are preparing the release version of your app for example to publish it to the google play store you will need to put some finishing touches on it for instance you will need to change the default icon the app name sign the app and of course add a build configuration for release and finally build the release app bundle or apk there are many approaches that you can use to implement the steps but in this video we will use the simplest one which is to follow the steps described in the flood of documentation especially we will focus on what is necessary to get your app ready for release in a future video i will show you how to effectively publish it to the play store if you would like to know in detail how to change icons add splash screens change app names check my playlist prepare and publish product apps the link will be in the description below now let's get our app ready for production the first thing that we will do is make sure that we replace the default product icon for that we will use the icon launcher package so let's head to the pubspec.yaml and under the dev dependencies we'll paste these lines to install the package this path is where the icon is located in our project hierarchy for more details about this package check the link in the description now let's open the terminal and run this command to generate the icons as you can see the icons were generated successfully before running the app to see the new icon let's also change this app name for that we will add to this path and read app src main and open the androidmanifest.xml here we will locate the android label attribute and replace its value by the name of our app let's say food receipts while we are here in the android manifest we can also set the permissions for example if our application code needs internet access we will add the android that permission that internet permission here now that we have changed the app icon and the app name let's run it to see the results if we did everything well we should see a new icon and a new app name here as you can see we have successfully replaced the app name and the default icon now the next step is to create our keystore to sign in up signing keystore's generation and why we need them can be the subject for another video for now you just need to keep in mind that to publish on the play store you need to give your app a digital signature google will use the signature to verify the app's owner even if you don't plan to publish your app to the play store you need to sign a release build to be able to install it on an android device as i said earlier to sign your app you need a key store if you already have one you can skip this section to generate a keystore you will use this command if you're on a mac and this one if you are on windows those are the paths where your keystore will be saved in this case it's in the current user home folder if you want you can change this path now let's create our key since i am using a mac i will copy this command go back to vs code open the terminal and paste it if this k2 comment is not in your path variables you'll receive an error like this one in that case as mentioned in the documentation we can run flood adductor v locate and copy the path after java binary at then we will replace the java at the end with k2 let's do that to escape the spaces in the path use backslash for macos and quotes for windows now let's hit enter they will ask you a bunch of questions about your name organization and country you will need to answer them and also you will need to enter two passwords one for the keystore and the other for the key here you can press enter if you want to use the same password that you entered earlier that means the keystore and the key will have the same password as you can see we have successfully created the keystore at this location the next step is now to reference the key store from the app to do that we will need to go back to the project and inside the android folder create a file called key.properties and paste those lines in it let's do that now now you need to provide those values that are related to the keystore that you just created the keystore password enki password in our case we use the same password the alias is the last word of the comment that you use to create the keystore and the keystore location which is the path where you stored it you should keep this key.properties file private don't check it into public source control now that we have created the key.properties file we need to add it to the app build.gradle for that we will go to android app and open the build.gradle note the project build gradle the app build griddle as mentioned in the documentation we will first locate this android section and add this block of code above it let's do that now the second step is to replace this build type section with this one let's do that with those configurations added the release build of your app will now be signed automatically now one final thing that we have to do is to review the default config section of the build.gradle the first value is the application id it looks like a java package name by default flutter set it to com that example that your project name you need to change it to your own for this app i will replace example by mjs decoding and publish android by food receipts this application id will uniquely identify your app on a device and in google play store if you change the application id google play store will treat the apk as a completely different app so once you publish your app you should never change the application id the main sdk version specifies the minimum api level the api level on which the app was compiled the target sdk version specifies the api level on which the app is designed to run when preparing to install your app android checks the value of these settings and compares them to the device api version if the min sdk version value is greater than the device api version the system prevents the installation of the app next are the version code inversion name the version called also called build number is a positive integer used as an internal version number it is not shown to the users the android system uses this number to prevent users from installing an apk with a lower version code than the version currently installed on their device so you can set the value to any positive integer you want however you should make sure that each successive release of your app uses a greater value just keep in mind that the greatest value google play allows for version code is this number version name also conversion number or build name is a string that is used as the app version element purpose is to be displayed to users it generally follows the format of three numbers separated by dots you can change those values in the pubspec.yaml file by setting the version property the first part is the version name and after the plus is the version code as explained in this comment section you can also override those values in the terminal when you are building the app using the bill name and build number parameters in a future video when we will publish our app for ios those values will be used to set the cf bundle show version string and the cf bundle version stay tuned for that video when you will need to publish an update for your app remember to come here to change the versions it's mandatory because both app stores use those values especially the build number to manage the updates since it's the first version of this app i will keep those values now that you have prepared your app and configured everything it's time to build it for release you have two possible release formats when publishing to the play store a bundle or apk in this video we will only generate the app bundle since it is the format recommended by the android team to understand the difference between app bundle and apk check this post the links will be in the description below now let's open the terminal and one flutter clean to wipe the build cache to make sure that we will build the app based on the configuration that we set up earlier to build the app bundle we'll paste this command flutter build a bundle now flutter will build your app for release and create the a bundle that you will upload to google play if you want to test the release version on a device you can build an apk instead by following those steps here in the documentation also it's good to know that when building for release by default floater will shrink obfuscate and optimize the app that means it will make your app as small as possible by removing unused code and resources and also shortens the names of your app's classes and members if you don't want that you can set the flag no shrank with the comment product build app bundle now the build has completed you will find the release bundle for your app at this path in this video we saw how to prepare and build an android app for production release soon i will upload a video on how to publish your android app to the play store to learn more about how to prepare and publish your flutter apps watch this video or that video since you've made it so far please give us a like subscribe and hit the notification bell for future content you
Info
Channel: MJSD Coding
Views: 111,688
Rating: undefined out of 5
Keywords: Flutter Build and Release an Android App App Signing, Build and Release For Android, Flutter Prepare App For Release, Build and Release apk in Flutter, App Signing, flutter android app bundle, flutter tutorial 2021, flutter release apk, flutter release app bundle, flutter release to, flutter release to android, how to release apk in flutter, how to build release apk in flutter
Id: g1fByAsqQRk
Channel Id: undefined
Length: 11min 2sec (662 seconds)
Published: Wed Feb 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.