Android Configuration

Don't open/change android code inside flutter because flutter doesn't compile android files.

If you want add/change android code, click on

Tools->Flutter->Open Android module in Android Studio Or File->Open ->open android module inside your project

Don't change package name inside android/app/src/main/AndroidManifest.xml file

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 the current.

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.

Now, replace ca-app-pub-1399327544318575~7586962359 with your new generated application id.

Now run the application. your ads are now live.

Open Android module in Android Studio

  • Open Android Studio.

  • Select Open an existing Android Studio Project.

  • Open the android directory within your app.

  • Wait until the project has been synced successfully. (This happens automatically once you open the project, but if it doesn’t, select Sync Project with Gradle Files from the File menu).

  • Now, click on Run button

Change Application Name

You must want to change your application name. This is how you can do. Follow the below step.

Open /android/app/src/main/AndroidManifest.xml and specify your application name.

manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />                    
        <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="YOUR_APPLICATION_NAME"
        android:icon="@mipmap/ic_launcher">
<activity>

Change Application Icon

See How to generate an application icon?

Browse your image and click on Download icon. After successfully generated, replace all icons in respective 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/ folderr

/mipmap-xxhdpi in /android/app/src/main/res/ folder

/mipmap-xxxhdpi in /android/app/src/main/res/ folder

Application icon name must be ic_launcher

Change Application ID

Follow the below steps to change your Application ID.

Open /android/app/build.gradle

defaultConfig 
{
    applicationId "YOUR_APPLICATION_ID"
    minSdkVersion 21
    targetSdkVersion 29
    versionCode 1
    versionName "1.0.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Deeplinks are a concept that helps users navigate between the web and applications. They are basically URLs that navigate users directly to the particular content in applications.

Open /android/app/src/main/AndroidManifest.xml and set your data.

<data
android:host="[YOUR_HOST]"
android:path="/[NAME][/NAME...]"
android:scheme="[YOUR_SCHEME_OR_HTTPS]" />

Host

The host name identifies the host where resource is located. A hostname is a domain name assigned to a host computer. This is usually a combination of the host's local name with its parent domain's name. For example, www.google.com consists of host's machine name www and the domain name google.com.

Path

The path identifies the specific resource within the host that the user wants to access. For example, /search/flutter, /flutter/flutter-sdk-setup/, etc.

Scheme

The scheme identifies the protocol to be used to access the resource on the Internet. The scheme names followed by the three characters :// (a colon and two slashes). The most commonly used protocols are http://, https://, ftp://.

Generate Signed APK

  1. Go to your project -> Tools -> Flutter -> Open for Editing in Android Studio as shown below

2. Open Project in New Window

Wait for while until project synchronization. After that Go to Build -> GenerateSigned Bundle/APK

3. Select Android App Bundle or APK Option as per your need. (Android App Bundle is best solution) and click Next button.

4. Select Create new.. option to generate new Signed key (When you release your app First Time) and Fill all options.

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

Last updated