To create a release version of your Flutter app in Android Studio, follow these steps:
1. Open the Run Configuration:- Click on the "Run" menu and select "Edit Configurations."
- In the "Run/Debug Configurations" dialog box, select your Flutter app from the list on the left.
--release
Flag:
- In the "Arguments" field, add the
--release
flag. - This flag tells Flutter to build the app in release mode.
--release
flag is not supported when building with the Android Emulator.
3. Build the APK:
- Click the "Build" menu and select "Build APK."
- This will generate a signed APK file that you can distribute to users.
- Open the project directory in Android Studio.
- Click on the "Build" menu and select "Generate Signed APK."
- Follow the prompts to create a keystore and generate the APK.
- Open the terminal and navigate to your Flutter project directory.
- Run the following command:
flutter build appbundle --release --build-name=1.1.1 --build-number=3
- Change the build name and build number to corresponding values of your release app versioning.
- Right-click on the green play button in the toolbar.
- Select "Customize Toolbar."
- Click on the "+" button and choose "Add Action."
- Select "Plugins/Flutter/Run in Flutter release mode."
- Delete the old Play button by selecting it and clicking on the "-" button.