Introduction
Flutter, a Google-created framework, facilitates open-source mobile app development for both Android and iOS platforms. It serves as the primary tool for creating applications, with shared configuration steps for Android and iOS compilation. This section will delve into these shared configuration steps.
Requirements
Flutter version 3.22.0
Dart version 3.4.0
Dev tools version 2.34.3
Engine revision edd8546116
Upstream repository https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (6 weeks ago) • 2024-06-05 22:15:13 +0200
To edit this project you must have Flutter and Dart installed and configured successfully on your device Install flutter
Recommended
Install Android Studio (Windows OS)
Install Android Studio (Mac OS)
Install Android Studio (Linux OS)
Install Flutter(Windows OS)
Install Flutter(Mac OS)
Install Flutter(Linux OS)
Get Started
Download and extract the Flutter application.Open the project using your preferred IDE: Android Studio, Visual Studio Code, or IntelliJ.
Edit the remote link in utils/app_constants.dart to establish a connection between your mobile app and the RestApi.
Navigate to the "android/app/src/main/res/mipmap-mdpi/launcher_icon.png" directory and substitute the existing image with your desired logo or app icon.
Configuration for Android
Change your app icon (ic_launcher.png) folders How to generate an app icon? after you generate icons folder
- /mipmap-hdpi in /android/app/src/main/res/ folder
- /mipmap-mdpi in /android/app/src/main/res/ folder
- /mipmap-xhdpi in /android/app/src/main/res/ folder
- /mipmap-xxhdpi in /android/app/src/main/res/ folder
- /mipmap-xxxhdpi in /android/app/src/main/res/ folder
Get Dependencies
Just run the following command
flutter clear
flutter pub get
Modify Package Name
To change the package name, follow these steps.
Modify the package name in the file located at /android/app/build.gradle.
defaultConfig {
applicationId "your package name"
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}- Then run the following command
flutter pub get
Run Android Application
In the target selector, choose an Android device to run the app. If no devices are available, go to Tools > Android > AVD Manager and create one. For detailed instructions, refer to the section on Managing AVDs.
"If you're not utilizing Android Studio or IntelliJ, you can employ the command line to execute your application with the following command:"
flutter run
Build And Install App
- Save your project after making changes.
- Open the console.
- Navigate to your project folder.
- Execute the command:
flutter build apk --release
to build your app. - When publishing your app on the Play Store, it's advisable to either employ app bundles or divide the APK into smaller parts to minimize its size.
- To create an app bundle, execute the following command in Flutter:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on https://developer.android.com/guide/app-bundle - Retrieve the APK file located in the build/output/apk folder. To install the application on your connected device, execute the following command.