How to Build Telegram for Android
Less than 1 minuteAbout 250 words
TL;DR
Clone from liblaf/Telegram and you are good to go. I have had release.keystore
and google-services.json
prepared.
Environment
Recommended Environment
- Android Studio 3.4
- Android NDK rev.20
- Android SDK 8.1
I am using
- Android Studio 2021.3.1.16
- Android NDK 21.4.7075529
- Android SDK 31.0.0
Compilation Guide[1]
- Download the Telegram source code from https://github.com/DrKLO/Telegram ( git clone https://github.com/DrKLO/Telegram.git )
- Copy your release.keystore into TMessagesProj/config
- Fill out RELEASE_KEY_PASSWORD, RELEASE_KEY_ALIAS, RELEASE_STORE_PASSWORD in gradle.properties to access your release.keystore
- Go to https://console.firebase.google.com/, create two android apps with application IDs org.telegram.messenger and org.telegram.messenger.beta, turn on firebase messaging and download google-services.json, which should be copied to the same folder as TMessagesProj.
- Open the project in the Studio (note that it should be opened, NOT imported).
- Fill out values in TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java – there’s a link for each of the variables showing where and which data to obtain.
- You are ready to compile Telegram.
Generate release.keystore
In Android Studio
- Find in Menu Bar: “Build” > “Generate Signed Bundle / APK …”
- Choose “APK” and click “Next”
- Click “Create New …” and fill in necessary fields
- Whatever
ASan compatibility
Telegram depends on some prebuilt static libraries. However, ASan requires a shared build.[2] I haven’t find a way to use ASan yet.