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

![](/files/-MlQQHPLOH9PhEl6jTPU)

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](/files/-MlQRxgXsnhpvKrJ8xon)

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

![](/files/-MlQTM_u_tWEJBL0rypH)

**2.** Open Project in New Window

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

![](/files/-MlQTnc6hPO3SU2t3b5v)

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

![](/files/-MlQU5xIKqUVn9Vg2ARX)

**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>" %}

![](/files/-MlQUZKYxTGFHCD5Dmwr)

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

![](/files/-MlQUn0zcLCZoa99MvcG)

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://megtrix.gitbook.io/appstelling/customize-appstelling-source-code/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
