Android Configuration
Introduction
FlUTTER
Flutter is Google’s UI toolkit for building beautiful, natively
compiled applications for Mobile, Web, and Desktop from a single
codebase. It is gaining popularity rapidly due to its ease of
learning and development efficiency
Requirements
To develop a Flutter project, you will need the following
requirements:
- Flutter SDK: Flutter is an open-source framework
developed by Google for building cross-platform applications.
You need to download and install the Flutter SDK, which includes
the Flutter framework, Dart programming language, and various
command-line tools.
- Integrated Development Environment (IDE): While you can
use any text editor to write Flutter code, it is recommended to
use an IDE for
better productivity. The popular choices for Flutter development
are Android Studio, Visual Studio Code (with Flutter and Dart
extensions), and
IntelliJ IDEA (with Flutter plugin).
- Dart programming language: Flutter uses the Dart
programming language. When you install the Flutter SDK, it
includes the Dart SDK as well.
You don't need to separately install Dart
- Device setup: Depending on your target platform(s), you
will need to set up the necessary devices for testing your
Flutter app. For Android,
you need to have Android Studio installed and set up an Android
Virtual Device (AVD) or connect a physical Android device. For
iOS,
you need a Mac computer with Xcode installed.
- Flutter dependencies: Depending on the specific
requirements of your project, you may need to include additional
Flutter dependencies.
These dependencies can be added to your project's pubspec.yaml
file, and Flutter's package manager, called pub, will handle the
installation
and management of these dependencies.
- Firebase Account: There are various functionality which
require Firebase Setup. Features like Social Login , Chat Module
and Notifications.
- Git: Although not mandatory, having a version control
system like Git is highly recommended for tracking changes in
your project and
collaborating with other developers if needed.
Additionally, having a basic understanding of programming concepts,
object-oriented programming (OOP), and the Flutter framework's
architecture will greatly help in developing Flutter projects
effectively.
Keep in mind that Flutter is a rapidly evolving framework, so it's a
good practice to stay updated with the latest releases and changes
by referring to the official Flutter documentation and community
resources.
Installation
- Flutter & Dart SDK:
- Choose an IDE:
- You can use any IDE such as Android Studio, Visual Studio
Code, or IntelliJ IDEA for Flutter development.
- Set up Your Editor:
- Git: Although not mandatory, having a version control system
like Git is highly recommended for tracking changes in your
project
and collaborating with other developers if needed.
For detailed installation instructions and troubleshooting, refer to
the
official Flutter documentation.
Basic Installation
Important: Choose Your Platform And Follow Steps To Build And
Run Application.
Install Flutter And Dart Plugins
Android Studio
- Open Android Studio.
- Go to Preferences(on macOS) or Settings (on
Windows/Linux).
- Select Plugins from the left sidebar.
- Click on the Marketplace tab.
- Search for "Flutter" in the search bar.
- Install the "Flutter" plugin by clicking on the green Install
button.
- Install "Dart" Plugin.
- Restart Android Studio when prompted.
Visual Studio Code
- Visual Studio Code
- Go to the Extensions view by clicking on the square icon in the
Sidebar.
- Search for "Flutter" in the Extensions Marketplace.
- Click on the "Install" button for the "Flutter" extension
provided by the Flutter team.
- Install "Dart" Plugin same way.
- After installation, you may need to restart Visual Studio Code
to enable the extension.
IntelliJ IDEA
- Open IntelliJ IDEA.
- Go to File → Settings (on Windows/Linux) or IntelliJ
IDEA → Preferences (on macOS).
- Go to File → Settings (on Windows/Linux) or IntelliJ IDEA →
Preferences (on macOS).
- Click on the Marketplace tab.
- Search for "Flutter" in the search bar.
- Install the "Flutter" plugin by clicking on the green install
button.
- Install the "dart" plugin same way.
- Restart IntelliJ IDEA when prompted.
Basic Setup
Here are the requirements for mobile configuration in Markdown
format:
Firebase
Firebase provides tools to grow your app and business, offering fully
managed backend infrastructure and features
for app development. Visit Firebase for more information.
Payment Methods
Mighty Fitness Laravel currently supports eight payment gateways. Here Some two examples are given below.
- Rozerpay Payment
- Stripe Payment
Open Android Module
- The Android module can be accessed in Two ways:
- Select the Android Module from the same project you're
attempting to open by going to File -> Open.
- Navigate to Tools -> Flutter -> Android Studio -> Open
Android Module.
Change Application Name
In the main directory, go to open
android/app/src/main/AndroidManifest.xml and specify your
application name.
Change Application Icon
IMPORTANT
Android Studio includes a tool called Image Asset Studio that
helps you generate your own app icons from material icons,
custom images, and text strings. It generates a set of icons at
the appropriate resolution for each pixel density that your app
supports. Image Asset Studio places the newly generated icons in
density-specific folders under the res/ directory in your
project. At runtime, Android uses the appropriate resource based
on the screen density of the device your app is running on.
Image Asset Studio helps you generate the following icon types:
- Launcher icons Adaptive & Legacy
- Legacy Launcher Icon
- Action bar and Tab Icons
- Notification icons
- Tv Banner
- Tv Channel Icon
For More Details You can checkout Android Studio Editor Guide for
creating Android Icons.
Generate Icon Process
- Configure Image Asset
- Choose Icon type
- Set Icon Name
- Choose Asset Type
- Customize Icon (Resize , Trim , Padding)
- Confirm Icon Path
- Choose Mode for Icon
- Finish
Generate App Launcher Icon
Method 1 : Use Android Studio To Generate Launcher Icons
- Go to
android/app/src/main/res
folder.
- Right-click on the
res
folder and select
Image → Asset News.
INFO
Foreground Layer : The foreground layer is the primary part of
the icon that contains the main visual elements. It's the layer
that the user selects the source asset for, which can be an
image, clip art or text.
Background Layer : The background layer is the area behind the
foreground layer. It can be used to add a background color or
image element to the icon. If you don't want green background
for laucher Icon then set background layer suitable to your
Launcher Icon.
- Choose Icon Type - "Launcher icons Adaptive & Legacy"
- Select the path of your Image and press Next.
- Select App mode for app Icon.
- Then Press Finish.
Method 2 : Generate Online
The basic process of this website is -
- Choose Asset type
- Basic Configuration
- Choose Device Type
- Generate and Get the Zip
- After extracting zip you get res folder replace it with your
android/app/src/main – res folder
Generate Notification Icon
- Go to
android/app/src/main/res
folder.
- Right-click on the
res
folder and select
New → Image Asset
.
- Choose Icon Type - "Notification"
- Select the path of your Image and press Next.
- Select App mode for app Icon.
- Then Press Finish.
Change notification icon in Androidmanifest.xml
- Navigate to android/app/src/main.
- Open your Androidmanifest.xml and check for lines below. If not
exist just add this line
otherwise Paste the Name of Icon you just created into
“android:resource“.
INFO
Update notification icon name into "lib → utils →
push_notification_service.dart" Follow
the Steps mentioned in Flutter
Configuration
Add Google JSON File
INFO
As part of enabling Google APIs or Firebase services in your
Android application, you need to set up Firebase and download
the Google JSON file.
Click Here to set
up Firebase and download the Google JSON file.
Generate Signed APK
To generate a signed APK (Android Package), follow these steps:
- Open the build menu and Select Generate Signed Bundle/APK.Choose
APK and click Next.
- Now you will have two options create a new Keystore or choose
existing keystore.
- If you choose to create a new keystore:
- A dialogue will appear, prompting you to specify the path of
the keystore and give it a name.
- Enter your password and confirm it.
- Select the alias name.
- Confirm the password.
- Enter any additional information if required.
- Click OK to create your keystore.
If you choose to use an existing keystore, simply select it.
After selecting your keystore or creating a new one, click Next.
Choose the release mode and proceed with building the APK.
NOTE
If you intend to publish your app on the Google Play Store, you
will need the AAB (Android App Bundle) format. To create an AAB,
follow the same steps mentioned above, but in step 2, select the
AAB option instead of APK.
Change The Application Id
IMPORTANT
Every Android app has a unique application ID that looks like a
Java package name, such as com.example.myapp.
This ID uniquely identifies your app on the
device and in the Google Play Store. Once you publish your app,
you should never change the Application ID.
- For Application ID, change the applicationId in the
app/build.gradle
file.
- Locate the
build.gradle
file at this path:
android/app/build.gradle.
Change The Version Name
IMPORTANT
The version name is a string value that represents the "friendly"
version name displayed to the users. The version name is
displayed to the user.
- For Version Name, change the
versionName
in the
build.gradle
file at the app level.
- Locate the
build.gradle
file at this path:
android/app/build.gradle
.
Change The Version Code
IMPORTANT
The version code is an incremental integer value that represents
the version of the application code.
The version code is used by the Google Play Store for new
updates. If you increase the version code, the update will be
visible to all users.
- For Version Name, change the
versionName
in the
build.gradle
file at the app level.
- Locate the
build.gradle
file at this path:
android/app/build.gradle
.
Change The App Name From Manifest File
IMPORTANT
To change the name of your Android application in Android Studio,
you have to change the value of the property
android:label
defined inside the
node in
AndroidManifest.xml
.
Setup Firebase
- For Firebase setup, you just need to change the android/app/google-services.json file.
- Create a new firebase account, register your application with your package name.
- Now download the google-services.json file and replace with current.
- Refer to Link
Setup Admob
- For AdMob setup, you just need to change the app id in android/app/src/main/AndroidManifest.xml file
- For that, you have to create a firebase account and create a new application in AdMob. and then you will get application id. Refer Create Admob Account
- Now, replace value with your new generated application id.
Generate Signed APK & AAB
- Go to your project -> Tools -> Flutter -> Open for Editing in Android Studio as shown below
- Open Project in New Window
- Wait for while until project synchronization. After that Go to Build -> GenerateSigned Bundle/APK...
- Select Android App Bundle or APK Option as per your need. (Android App Bundle is best solution) and click Next button.
- Select Create new.. option to generate new Signed key (When you release your app First Time) and Fill all options. Refer this link
- Click Next button and you will get following screen...
Select Build variants - release and Signature versions both V1 and V2 respectively as shown above screen shot and click Finish button.
- Wait for a while until Gradle Build Running process complete.and finally you will get the Generate Signed APK : (APKs) generated successfully. from that click on Locate option to get Location of your Generate Signed APK Key.