Android

Install Flutter

To compile the application you will need to have the latest version of flutter installed on your computer. You can refer to Flutter's official documentation for the installation:

Application ID

You will need to assign an application id to the application. It is better to check if the application ID is not already taken on Play Store so you won't have to change this ID later. Open build.gradle In the app folder and replace the application id with yours. Usually the format is com.<Organization>.<Product>.<Application>
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ridy.taxi.driver"
minSdkVersion 23
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

Generate Release Keystore

Now on your machine create a release Keystore for your application using the below command (Replace [your_alias_name] with an alias of your choice)
keytool -genkey -v -keystore keystore.jks -alias [your_alias_name] -keyalg RSA -keysize 2048 -validity 10000
After entering this command you will be asked some questions. This information will be used to sign the Application. Copy the path to this Keystore and open the key.properties file in the android/app folder. Edit this file's parameters to passwords and path of Keystore.

Get SHA-1 & SHA-256 key

Now that you have created the release Keystore you will need to retrieve this and debug the key's signature so Firebase could verify the incoming request is from your app and not forged.
To do so go to the app folder of the android project and enter the below command:
../gradlew signingreport
After a few seconds, you will be presented with the signature of variants your application has. You will need to get both SHA-1 & SHA-256 fingerprints for both debug and release as you will need them in the Firebase configuration section.

Firebase

Go to the Project setting of the Firebase project and create two Android applications with the application id you have chosen for the apps. Once projects are created enter all 4 fingerprints you were asked to keep for the Firebase configuration. (If you don't intend to develop the 2 test ones are enough as you can see below)
Now use the download "google-services.json" button to get the file. In the android folder, you can find a file with the same name. Replace it with the one downloaded here.
These steps were supposed to be repeated for both Driver and Rider. Now is a good time to repeat the other one.

Build

Now you can run the below command in the flutter project folder to build the APK:
flutter build apk
Or if you want to get the App Bundle for the Play Store release you can use this command:
flutter build appbundle
Once the build is done console output shows the folder where the output file resides.
You can upload the App Bundle file to the Play Store after you run your tests. The only thing that needs to be kept in mind is that uploaded to store files are signed again by Play Store so you will need to go to the App Integrity Section of Google Play and get the fingerprints presented to you and add them to your Firebase console's app configuration menu.