# Android Configuration

**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](https://firebase.google.com/docs/android/setup)

<br>

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

<br>

**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>
  ```

<br>

**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 folders:
* /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

**Change Application ID**

* Follow the below steps to change you 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"
  }
  ```
* <br>
* **Generate Signed APK**
* * Go to your project -> Tools -> Flutter -> Open for Editing in Android Studio as shown below
  * \
    \ <br>

    <figure><img src="https://vpndocs.dokkan.agency/images/apk_step1.png" alt=""><figcaption></figcaption></figure>
  * Open Project in New Window
  * Wait for while until project synchronization. After that Go to Build -> GenerateSigned Bundle/APK...
  * \
    \ <br>

    <figure><img src="https://vpndocs.dokkan.agency/images/apk_step2.png" alt=""><figcaption></figcaption></figure>
  * Select Android App Bundle or APK Option as per your need. (Android App Bundle is best solution) and click Next button.
  * \
    \ <br>

    <figure><img src="https://vpndocs.dokkan.agency/images/apk_step3.png" alt=""><figcaption></figcaption></figure>
  * Select Create new\.. option to generate new Signed key (When you release your app First Time) and Fill all options. [Refer this link](https://developer.android.com/studio/publish/app-signing#generate-key)
  * \
    \ <br>

    <figure><img src="https://vpndocs.dokkan.agency/images/apk_step4.png" alt=""><figcaption></figcaption></figure>
  * Click Next button and you will get following screen...
  * \ <br>

    <figure><img src="https://vpndocs.dokkan.agency/images/apk_step5.png" alt=""><figcaption></figcaption></figure>
  * 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.
