> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Android from source

> Build a signed APK or AAB in Android Studio.

## Step 1: Install Android Studio and required SDKs

Before building your Median Android app, install Android Studio and configure your local development environment.

Download the latest version of [Android Studio](https://developer.android.com/studio#downloads).

Follow the steps in the [Android Studio installation guide](https://developer.android.com/studio/install). Make sure to follow the Setup Wizard and install all recommended SDK packages.

> [!NOTE]
>
> **Tip**
>
> During setup, be sure to install the **Android SDK Platform** and all required components.

## Step 2: Download the Android source code

Download the Android source code from your app's private management page by opening the "**Build & Deploy**" tab and clicking the "**Download**" button in the Android SOURCE CODE category.

![Download button for the Android source code on the Build & Deploy tab in App Studio](https://mintcdn.com/median-co/TpSItjrYpkPK-i0N/images/docs/b453a508d9dc9e9d40de313c03b6692def1de8d4a24c5cd6d2c98ee6ce4281c2-Screenshot_2025-07-04_at_14.09.57.png?fit=max\&auto=format\&n=TpSItjrYpkPK-i0N\&q=85\&s=9bc2939cb49753aacf3d466ee3a1d7e8)

Download the Android source in App Studio

## Step 3: Extract the source archive

Extract the downloaded `android_source.tar.gz` file and open your app using one of the following methods.

1. Double-click the `android_source.tar.gz` file in Windows Explorer or the macOS Finder.
2. Open a command prompt or terminal session and run the command `tar -xzvf android_source.tar.gz`

> [!WARNING]
>
> **Using tar command**
>
> The `tar` command in method #2 requires Windows 10 or macOS. It extracts the files to a subdirectory named “android”. If a directory with the same name exists, it's overwritten.
>
> You can change this behavior by defining a different output directory `tar -xzvf android_source.tar.gz -C /target/directory`

Once extracted, open the extracted directory and you will see files similar to Figure 2:

![Files in the extracted Android source directory](https://mintcdn.com/median-co/yvThAkXSLqPa6nzP/images/docs/f62c2d0a456777a470a486978c9cac5bf4f03079fd52043508d184eb5ddc283d-Screenshot_2025-07-04_at_14.14.16.png?fit=max\&auto=format\&n=yvThAkXSLqPa6nzP\&q=85\&s=1888b298945570b69e63cbc4ecbe5933)

Figure 2: Source archive content

## Step 4: Open the project in Android Studio

Open Android Studio and click the "**Open**" button as seen in Figure 3 to open your app.

![Open button on the Android Studio welcome screen](https://mintcdn.com/median-co/7LCOHMhgIef7ewYE/images/docs/6366ac4-3_Android_Source_OpenProject.png?fit=max\&auto=format\&n=7LCOHMhgIef7ewYE\&q=85\&s=76dd3b7c8a2cdf170b50d2a0b5c3f70c)

Figure 3: Open a new Android project

Now, navigate and select the extracted directory and click “**Open**”.

![Extracted Android source directory selected in the Android Studio file dialog](https://mintcdn.com/median-co/TpSItjrYpkPK-i0N/images/docs/c780d3e-4_Android_Source_SelectProject.png?fit=max\&auto=format\&n=TpSItjrYpkPK-i0N\&q=85\&s=410a4986e612fef04ecf7d708f7e8853)

Figure 4: Open the Android source directory

Next, Android Studio will ask you whether to open your project in Safe mode or to trust the project. To build/run/debug your app without [restrictions](https://www.jetbrains.com/help/idea/project-security.html#projects_security), select “**Trust Project**”.

![Android Studio dialog with the Trust Project option](https://mintcdn.com/median-co/TpSItjrYpkPK-i0N/images/docs/b86e141-5_Android_Source_TrustProject.png?fit=max\&auto=format\&n=TpSItjrYpkPK-i0N\&q=85\&s=13af95dab14fa4e0b626f0edab2e8229)

Figure 5: Trust and open project

## Step 5: Run or debug your app

Wait for Android Studio to initialize the project, and once finished you will see `BUILD SUCCESSFUL` in the Build Output panel as seen in Figure 6:

![Android Studio Build Output panel showing BUILD SUCCESSFUL, with device selector and run and debug icons](https://mintcdn.com/median-co/TpSItjrYpkPK-i0N/images/docs/b46b7c1-6_Android_Source_RunOrDebugProject.png?fit=max\&auto=format\&n=TpSItjrYpkPK-i0N\&q=85\&s=6c256246186669cbc75918d315e5b519)

Figure 6: Android Studio debug and console

Now, as seen in Figure 6, select an emulator or connect a physical Android device to your computer, and select your device in the drop-down menu.

To run your application, click the run icon. Android Studio builds, installs, and runs your application on the selected emulator or device.

To debug your application, click the debug icon.

## Step 6: Generate a signed APK or app bundle

To create a signed bundle or apk for publishing to Google Play, you need a keystore file, generally named `release.keystore`, that you will use to sign your bundle or apk.

If you would like to use the same keystore that we use for build through our website, please first purchase a license and then contact us.

Once you have your keystore, in Android Studio, select **Build → Generate Signed Bundle / APK**.

![Generate Signed Bundle / APK option in the Android Studio Build menu](https://mintcdn.com/median-co/dZQPJ_0wlG7WNBTy/images/docs/353938d-7_Android_Source_SelectGenerateSignedApkOrAab.png?fit=max\&auto=format\&n=dZQPJ_0wlG7WNBTy\&q=85\&s=529431b9224289519bdbc668868e3a49)

Figure 7: Build menu

Select Android App Bundle or APK and click “**Next**”.

![Generate Signed Bundle or APK dialog with Android App Bundle and APK options](https://mintcdn.com/median-co/7LCOHMhgIef7ewYE/images/docs/690ccad-8_Android_Source_GenerateApkOrAabDialog.png?fit=max\&auto=format\&n=7LCOHMhgIef7ewYE\&q=85\&s=7bde7918c1f165123ee6669f18ab8ae6)

Figure 8: Signed bundle or APK dialog

As seen in Figure 9, you will be asked to provide the path of your keystore file and the credentials attached to it.

If you're using the Median-provided keystore, use these credentials:

**Keystore password:** `password` **Key alias:** `release` **Key password:** `password`

![Keystore path, password, and key alias fields in Android Studio](https://mintcdn.com/median-co/dZQPJ_0wlG7WNBTy/images/docs/40bd206-9_Android_Source_SelectKeystoreApk.png?fit=max\&auto=format\&n=dZQPJ_0wlG7WNBTy\&q=85\&s=d64b0edd07502ca6e5075af0eee789ab)

Figure 9: Keystore configuration

Once you have entered the keystore parameters, click “**Next**”.

As shown in Figure 10, provide the destination path of your generated Bundle / APK, select `normalRelease` and click “**Create**”.

![Destination folder and normalRelease build variant selected in Android Studio](https://mintcdn.com/median-co/7LCOHMhgIef7ewYE/images/docs/691d68b-10_Android_Source_GenerateReleaseApk.png?fit=max\&auto=format\&n=7LCOHMhgIef7ewYE\&q=85\&s=ec1698e922ae414600114cc829b7fde8)

Figure 10: Release configuration

Once Android Studio has finished building the requested file, you will see a success notification at the bottom right corner of Android Studio with a `locate` button, as seen in Figure 11. The `locate` link opens the directory containing your generated file, as shown in Figure 12.

Alternatively, navigate to the `/normal/release` directory to see your generated file.

![Android Studio notification with a locate link after the build finishes](https://mintcdn.com/median-co/dZQPJ_0wlG7WNBTy/images/docs/0ad0ecf-11_Android_Source_LocateReleaseApk.png?fit=max\&auto=format\&n=dZQPJ_0wlG7WNBTy\&q=85\&s=8fa7cf4bda602178263ae95ac605989c)

Figure 11: APK generation progress

![Generated release APK file in the output directory](https://mintcdn.com/median-co/yvThAkXSLqPa6nzP/images/docs/f003bb7-12_Android_Source_ReleaseApk.png?fit=max\&auto=format\&n=yvThAkXSLqPa6nzP\&q=85\&s=e0f207d255e361aefe5b53d268f73d9d)

Figure 12: Generated APK file


## Related topics

- [Android build and deployment](https://docs.median.co/docs/android-build-deployment.md)
- [Android debugging](https://docs.median.co/docs/android-debugging.md)
- [Upload Android to Google Play](https://docs.median.co/docs/upload-android-to-google-play.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.