> For the complete documentation index, see [llms.txt](https://megtrix.gitbook.io/appstelling/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://megtrix.gitbook.io/appstelling/customize-appstelling-source-code/untitled.md).

# Android Configuration

{% hint style="danger" %}
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**
{% endhint %}

{% hint style="danger" %}
Don't change package name inside **android/app/src/main/AndroidManifest.xml** file
{% endhint %}

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

{% embed url="<https://firebase.google.com/docs/android/setup>" %}

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

![](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQPwusLJmP2aDynamU%2F-MlQQHPLOH9PhEl6jTPU%2Fadmob_1.png?alt=media\&token=5b451f49-6e36-4960-a4bc-bee698ebc833)

Now run the application. your ads are now live.

## &#x20;**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

## &#x20;**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>
```

## &#x20;**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

{% hint style="warning" %}
Application icon name must be ic\_launcher
{% endhint %}

## &#x20;**Change Application ID**

Follow the below steps to change you**r** 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"
}
```

## &#x20;**Deeplink**

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.

### &#x20;**Set Deeplink**

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]" />
```

![Setting Deeplinking](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQPwusLJmP2aDynamU%2F-MlQRxgXsnhpvKrJ8xon%2Fdeeplink.png?alt=media\&token=97a576b0-3c9e-4b56-8b62-655f556128f9)

#### 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](http://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\://.

## &#x20;**Generate Signed APK**

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

![](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQSNhJFuIEv9xG3sRU%2F-MlQTM_u_tWEJBL0rypH%2Fapk_step1.png?alt=media\&token=ff120bad-14f7-4881-a505-55d54f9790ed)

**2.** Open Project in New Window

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

![](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQSNhJFuIEv9xG3sRU%2F-MlQTnc6hPO3SU2t3b5v%2Fapk_step2.png?alt=media\&token=4d4ff731-5929-4e51-991b-51bc14c81993)

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

![](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQSNhJFuIEv9xG3sRU%2F-MlQU5xIKqUVn9Vg2ARX%2Fapk_step3.png?alt=media\&token=28d91b16-750b-4b8f-b3dd-1be4c02075d7)

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

{% embed url="<https://developer.android.com/studio/publish/app-signing#generate-key>" %}

![](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQSNhJFuIEv9xG3sRU%2F-MlQUZKYxTGFHCD5Dmwr%2Fapk_step4.png?alt=media\&token=0cd93d70-6368-4fd2-ba6a-d150cb0c56c0)

**5.** Click Next button and you will get following screen

![](https://3378427421-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlPjb87mlbH_F5tU6wt%2F-MlQSNhJFuIEv9xG3sRU%2F-MlQUn0zcLCZoa99MvcG%2Fapk_step5.png?alt=media\&token=26a25f39-6eae-48bc-956d-d4f5d2a87022)

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.
