# Building a Custom Telegram Android Client from the Official Source

> DrKLO/Telegram is the official Android source code for the Telegram messaging app, published under GPL-2.0. Developers who want to build a private fork or study the MTProto implementation must register their own API credentials and replace all dummy configuration files before compiling.

**DrKLO/Telegram** — Telegram for Android source

- Repository: https://github.com/DrKLO/Telegram
- Stars: 29,912 · Forks: 10,086
- Language: Java
- License: GPL-2.0
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/drklo-telegram

## What This Repository Is and Who Should Use It

DrKLO/Telegram is not a library or a bot framework. It is the complete Android application source code for the Telegram messaging app, published by the Telegram development team under the GPL-2.0 license. The intended audience is developers who want to build their own fork of the Telegram Android client, study the underlying MTProto protocol implementation, or contribute to the project's reproducible build effort.

The README makes the distinction between the app and the source code explicit: this is the official source for the Telegram App for Android available on Google Play. Using this source to build a competing or derivative app is explicitly welcomed, but the README sets out four requirements for all developers: obtain your own api_id from core.telegram.org, do not use the name Telegram for your app unless you make clear to users it is unofficial, do not use the standard white paper plane logo, and publish your own source code to comply with the GPL-2.0 license. The MTProto protocol documentation is at core.telegram.org/mtproto.

## Repository Structure and Build Variants

The repository contains several top-level project directories that correspond to different distribution variants of the Android app. TMessagesProj/ holds the core messaging code. TMessagesProj_App/ is the standard Play Store variant. TMessagesProj_AppHuawei/ targets Huawei AppGallery. TMessagesProj_AppStandalone/ is a standalone variant without Google dependencies. TMessagesProj_AppHockeyApp/ was used for a beta distribution channel. TMessagesProj_Modules/ contains shared modules, and TMessagesProj_AppTests/ holds the test suite.

The project uses Gradle as its build system, with a top-level build.gradle and a settings.gradle that declares all subprojects. The buildSrc/ directory contains Gradle build scripts. The Tools/ directory includes utilities including apkdiff.py and apkfrombundle.py, which support the reproducible build verification process. The Dockerfile at the root of the repository provides a complete Android build environment using gradle:8.13-jdk17 as the base image, with Android SDK 36, NDK 27.2.12479018, and build tools 36.0.0 pre-installed.

## Setting Up the Build Environment

The README specifies Android Studio 2025.1.4, Android NDK version 27.2.12479018, and Android SDK 36 as the required toolchain. The first step is cloning the repository with all submodules, which the README gives as:

```bash
git clone --recursive --shallow-submodules https://github.com/DrKLO/Telegram.git Telegram
```

If the clone was done without the recursive flag, the README provides the recovery command:

```bash
git submodule init && git submodule update --init --recursive --depth=1
```

After cloning, the README instructs developers to copy their release.keystore into TMessagesProj/config, fill RELEASE_KEY_PASSWORD, RELEASE_KEY_ALIAS, and RELEASE_STORE_PASSWORD in gradle.properties, and open the project in Android Studio (not imported, which the README specifically flags as a distinction). The project must then be opened, not imported, because the two operations differ in how Android Studio resolves the project configuration.

## Configuring Firebase and API Credentials

Two separate Firebase application IDs must be configured before the project will build correctly for distribution. The README instructs developers to create two Android apps in the Firebase console at console.firebase.google.com: one with the application ID org.telegram.messenger and one with org.telegram.messenger.beta. Firebase Cloud Messaging must be enabled for both. The resulting google-services.json file is placed in the same folder as TMessagesProj.

The file TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java contains variables that must be filled in, and the README notes that each variable has a link showing where to obtain the required data. The most critical of these is the api_id obtained from core.telegram.org/api/obtaining_api_id. The README notes that the repository intentionally ships dummy values for release.keystore, google-services.json, and the filled variables inside BuildVars.java to support reproducible builds, and that all three must be replaced before publishing any APK.

## Reproducible Builds and Docker

The README references Telegram's broader reproducible builds initiative at core.telegram.org/reproducible-builds. The inclusion of dummy configuration files in the repository is a deliberate choice to enable build verification: anyone can clone the repository, replace the dummy files with the published versions, and confirm that the resulting binary matches the published APK.

The Dockerfile at the repository root automates the Android environment setup. It installs the Android command-line tools at version 15859902, accepts SDK licenses, and installs build-tools 36.0.0, the android-36 platform, platform-tools, NDK 27.2.12479018, and cmake 3.22.1. The default CMD in the Dockerfile runs a parallel Gradle build covering the AFAT release and standalone variants as well as the Huawei variant. Using Docker removes the need to configure a local Android SDK installation and makes the build environment reproducible across machines. The Dockerfile uses the linux/x86_64 toolchain path, which affects developers running on ARM hardware.

## Localization and What the Source Does Not Cover

The README states that all translations have moved to translations.telegram.org/en/android/. Developers who want to add or modify a language should use that platform rather than editing string files directly in the source.

The README does not document the MTProto protocol in detail beyond pointing to the external documentation at core.telegram.org/mtproto and the API manuals at core.telegram.org/api. Developers who want to understand the encryption layer or implement compatible clients in other languages will need to study those external documents. The README also does not cover the process for submitting changes back to the official app or for getting forks listed in app stores, since those processes are governed by the respective store policies and Telegram's own developer relations. The recent releases (v11.4.2 in late 2024 is the most recent tagged release) indicate that tagging has not kept pace with the push history, so build-specific version information may require checking the commit log.

## GPL-2.0 License Obligations and the Signal Alternative

The GPL-2.0 license has a direct consequence for any developer who publishes a derivative app built from this source: they must also publish the source code of their modifications. The README states this plainly as one of its four requirements for all developers. For teams building internal tools that are never distributed, this obligation does not apply. For teams planning to publish to Google Play or Huawei AppGallery, it means the source code of the customized fork must be available.

Signal is the most direct alternative for developers interested in end-to-end encrypted messaging source code. Signal's Android client is also open source, but it uses the Signal Protocol rather than MTProto. The difference in approach is architectural: MTProto is Telegram's proprietary protocol with its own specification and server infrastructure, while the Signal Protocol is a third-party cryptographic ratchet used by multiple messaging applications. Developers choosing between the two are also choosing between different server ecosystems. This repository connects to Telegram's own server infrastructure; any fork must either use those same servers with the registered api_id or run its own server implementation.

## Conclusion

Developers who want to build a private Telegram-compatible Android client, study the MTProto protocol implementation, or contribute to reproducible builds should use this repository. Anyone who wants to rebrand and publish the resulting app as a commercial product needs to understand the GPL-2.0 obligations: the source code of the derived app must be published. Teams who only need to use Telegram as an end-user communication tool have no reason to compile from source. Before starting a build, verify that the development machine can run Android Studio 2025.1.4, that the Android NDK version 27.2.12479018 is available through the SDK manager, and that a Firebase project exists with the correct application IDs configured.

## FAQ

### What is Telegram mainly used for?

Telegram is a messaging app with a focus on speed and security, as stated in the README. It supports text messaging, group chats, channels, and file sharing through its Android client.

### How do you compile Telegram from source?

You need Android Studio 2025.1.4, NDK 27.2.12479018, and SDK 36. Clone the repository with the recursive flag, replace the dummy keystore and google-services.json files, fill in BuildVars.java with your own API credentials obtained from core.telegram.org, then open the project in Android Studio.

### Do I need my own API key to build the Telegram Android source?

Yes. The README requires all developers to obtain their own api_id from core.telegram.org/api/obtaining_api_id. The repository ships dummy values for BuildVars.java and other configuration files that must be replaced before publishing any APK.

### What license does the Telegram Android source use?

The repository is licensed under GPL-2.0. The README explicitly states that developers who publish a derived app must also publish their source code to comply with the license.

## Sources

- [DrKLO/Telegram on GitHub](https://github.com/DrKLO/Telegram)
- [Issues](https://github.com/DrKLO/Telegram/issues)
- [License: GPL-2.0](https://github.com/DrKLO/Telegram/blob/master/LICENSE)
- [README](https://github.com/DrKLO/Telegram/blob/master/README.md)
- [Releases](https://github.com/DrKLO/Telegram/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/drklo-telegram
