Docly Child

Android Configuration

Estimated reading: 6 minutes 110 views

Opening Android Module

  • The Android module can be accessed in Two ways
  1. Select the Android Module from the same project you’re attempting to open by going to File -> Open

   2. Navigate to Tools -> Flutter -> Android Studio-> Open Android Module

Changing 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 Google Play Store. Once you publish your app, you should never change the Application ID

  • For Application ID just change in build.gradle at app level only
  • You can locate the build.gradle file on this path android/app/build.gradle
  • This Application Id will be used in firebase to setting up the firebase
defaultConfig {
    applicationId "YOUR_PACKAGE_NAME"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Changing the Version Name

IMPORTANT

The version name is a string value that represents the “friendly” version name displayed to the users. Version name is displayed to the user.

  • For Version Name just change in build.gradle at app level only
  • You can locate the build.gradle file on this path android/app/build.gradle
defaultConfig defaultConfig {
    applicationId "com.iqonic.example"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode 1
    versionName "CHANGE_THE_VERSION_NAME"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Changing the Version Code

IMPORTANT

The version code is an incremental integer value that represents the version of the application code.Version code is used by google play store for new update. If you have increased version code then update will be visible to all user.

  • For Version Code just change in build.gradle at app level only
  • You can locate the build.gradle file on this path android/app/build.gradle
defaultConfig defaultConfig {
    applicationId "com.iqonic.example"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode "CHANGE_THE_VERSION_CODE"
    versionName "1.0.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Changing the Appname from manifest file

IMPORTANT

Whenever you make a project in Android studios you give a project name, your app’s name is derived from that. The user will know your app with this name on Google PlayStore.

  • 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 Application node in AndroidManifest.xml
 android:label="YOUR_APP_NAME"

Changing the App 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:

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 Launcher Icon

Method 1 : Use Android Studio to Generate Launcher Icons

  • Build project in android module. After project is built successfully following steps to change the icon.
  • Right click on app and go to this path  New -> Image Asset. 
  • Choose Icon Type
  • Select the path of your Image and press Next.
NOTE

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.

  • Select App mode for app Icon From Res Directory. 
  • 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

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“.

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_stat_notification" />

Changing the Host Name

IMPORTANT

This step is for handling deep linkling process.

What will be your host name , scheme and path prefix?

for i.e
DOMAIN_URL = “https://example.com/xyz’;

  • The Protocol is considered as “android:scheme” ( i.e – https or http)
  • The middle part will be the “android:host” ( here – example.com)
  • Change android:host
  • android:scheme
  • android:pathPrefix is optional
 <!-- Deep linking -->
             <meta-data
                android:name="flutter_deeplinking_enabled"
                android:value="true" />
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="example.com"
                    android:pathPrefix="/xyz/"
                    android:scheme="https" />
</intent-filter>

Generating Signed APK

  1. Open the build -> Generate Signed Bundle/APK -> Select APK and click next
  • Now you will have two options create a new Keystore or choose existing keystore.
  • If you choose NEW keystore, a dialogue will appear in which you must specify the path of the keystore and give it a name.
  • Then enter your password and confirm it. Select the Alias name, confirm the password, and enter any additional information before clicking OK. Your key store has been created.
  • Then click the next button, choose the release mode, and begin building the apk.
NOTE

To Publish the app in Google Play Store, you will need the AAB(Android App Bundle), So to create the AAB, you have to follow the same steps, just that you have to select the AAB option in step 2 instead of APK

Great! You have successfully configured Android Module!

Leave a Comment

Share this Doc
CONTENTS