# Setup Instructions

### 1. Cloning the Flutter Project

Open a terminal, and clone the project from GitHub. Please, make sure git is installed before doing this.

```bash
$ git clone https://github.com/Imperial-lord/INR-miAyarla.git
```

### 2. Setting up Firebase.

Open the Firebase project and head to the Project Settings. Or directly click on this [link ](https://console.firebase.google.com/u/0/project/inr-ayarla/settings/general/android:com.meceware.inr_mi_ayarla)(won't open unless signed in with proper Google account to access the Firebase Project).

![Note: Content has been whitened in the picture to maintain privacy.](https://79350708-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MYcMbY501kqb8HuYrj-%2F-M_y9geav-RNcUiTsmOt%2F-M_yHkhwKnIdXplj73LJ%2FScreenshot%20\(59\)_LI.jpg?alt=media\&token=70057aa6-be1f-454d-a569-652315536810)

Find the app settings, and add your debug SHA keys. To generate the debug SHA keys use the following commands -

{% tabs %}
{% tab title="Mac or Linux" %}

```
keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore
```

{% endtab %}

{% tab title="Windows" %}

```bash
keytool -list -v \
-alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
```

{% endtab %}
{% endtabs %}

or follow the instructions here -&#x20;

{% embed url="<https://developers.google.com/android/guides/client-auth>" %}

{% hint style="info" %}
While following the steps to generate the debug SHA-1 and SHA-256 keys keep the following in mind:

* It is possible that the **debug.keystore** file, has not yet got generated, so you might not be able to generate the SHA keys. For that please follow step 3 and onwards without adding any keys, and run your the code once. This will generate your **debug.keystore** file.
* When running the above commands, it'll prompt you for a password. Use ***android***, as the default password.
  {% endhint %}

After that download the [**google-serivces.json**](https://developers.google.com/android/guides/google-services-plugin) and replace it inside the project. This is found inside the **`android/app`** folder. We will need to do this anytime we make some changes to the app, like adding release keys, or changing other parameters.

### 3. Preparing for app release.

Since the app is already in release, parts of [**build.gradle**](https://developer.android.com/studio/build) have been modified for the same. To make sure your app runs, make sure to follow these 2 steps.

#### a) Signing the app.&#x20;

A detailed instruction for this can be found here -&#x20;

{% embed url="<https://flutter.dev/docs/deployment/android#signing-the-app>" %}

Enter the command below in a terminal. This command stores the `upload-keystore.jks` file in your home directory. If you want to store it elsewhere, change the argument you pass to the `-keystore` parameter.&#x20;

{% tabs %}
{% tab title="Mac or Linux" %}

```bash
  keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 
  -validity 10000 -alias upload
```

{% endtab %}

{% tab title="Windows" %}

```bash
  keytool -genkey -v -keystore c:\Users\USER_NAME\upload-keystore.jks 
  -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Keep the **`keystore`** file private; never check it into public source control!
{% endhint %}

{% hint style="info" %}
The **keytool** command might not be in your path — it’s part of Java, which is installed as part of Android Studio. For the concrete path, run **flutter doctor -v** and locate the path printed after ‘Java binary at:’. Then use that fully qualified path replacing **java** (at the end) with **keytool**.
{% endhint %}

After this step,  create a file named `[project]/android/key.properties` that contains a reference to your keystore. This should never have be checked into public source control. Usually it's in the git ignore by default.

{% code title="key.properties" %}

```bash
storePassword=<password from previous step>
keyPassword=<password from previous step>
keyAlias=upload
storeFile=<location of the key store file, such as /Users/<user name>/upload-keystore.jks>
```

{% endcode %}

At this stage you should be able to run the project (*but will not be able to use Firebase related functionality yet*). To run the flutter app, simple open a terminal, navigate to the root directory of your project, and simply enter:

```bash
flutter run
```

#### b) Adding release keys to Firebase project.&#x20;

Now that the app has been successfully run, we need to complete setting up the firebase. Release keys be generated in the same manner as debug keys, with the exception that now you need to replace the `debug.keystore` with your generated keystore (previously referred to as `upload-keystore.jks`) file after signing the app. This answer clearly describes the steps for the same.&#x20;

{% embed url="<https://stackoverflow.com/questions/15727912/sha-1-fingerprint-of-keystore-certificate?page=1&tab=votes#tab-top>" %}

After all generated keys are added, re-download and replace the [**google-serivces.json**](https://developers.google.com/android/guides/google-services-plugin) file in the project as before.

### 4. And that's all.

Congratulations! You have successfully set up the project and are ready to use the code to build something amazing.&#x20;


---

# 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://inr-mi-ayarla.gitbook.io/docs/setup-instructions.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.
