
Have you heard the story about the developer who lost the key to his app? I've heard it too. He had an app in the Play Store with millions of downloads, and when it was time to release an update, the keystore was irretrievably lost. The app had to be re-released under a new name, and all the old users were lost. Since then, I've treasured keys like the apple of my eye.
In this topic, we'll look at Android APK Signing Tool v2—a convenient graphical utility for signing APKs. For anyone who needs to sign an app in a couple of clicks without messing around with the console, this is perfect.
Part 1: What is an APK signature and why is it needed?
When you build an APK, it's just an archive of files. Anyone can disassemble it, change the code, reassemble it, and release it under your name. A signature solves this problem.
A digital signature does three things:
Identifies the developer. The Play Store and devices know that this app was signed by you. Guarantees integrity. If the APK is changed after signing, the signature will break, and the system will prevent it from being installed.
Allows updates. Google Play verifies that the new app is signed with the same key as the old one. Otherwise, they are considered different apps.
Part 2: What is Android APK Signing Tool v2
This is a graphical wrapper for standard Java and Android utilities—jarsigner, apksigner, and zipalign. It allows you to sign APKs without opening a terminal or memorizing commands with a bunch of parameters.
This tool is useful when:
You need to quickly sign a test APK;
You don't want to mess around with the command line;
You need to verify that the keystore is configured correctly.
Part 3: What you need to use this tool
Before running the tool, make sure you have everything you need on your computer.
3.1. Java Development Kit (JDK) This utility is written in Java and uses jarsigner. The JDK must be installed.
You can check with the command:
```
java -version
```
If Java isn't installed, go to the Oracle or OpenJDK website and install version 8 or higher.
3.2. Android SDK Build-Tools This contains the zipalign and apksigner utilities. They are usually installed with Android Studio.
The paths to them are as follows:
Windows: C:\Users\Name\AppData\Local\Android\Sdk\build-tools
macOS: ~/Library/Android/sdk/build-tools
Linux: ~/Android/Sdk/build-tools
3.3. The tool itself is located on GitHub or forums like XDA. Look for APK_Signer_Tool_v2.jar or something similar. Download it from a trusted source.
Part 4: First Run and Path Configuration
Run the tool with the command:
```
java -jar APK_Signer_Tool_v2.jar
```
A window with tabs and fields should open.
First, you need to specify the location of the JDK and Build-Tools.
For the JDK: Specify the root Java folder. For example:
Windows: C:\Program Files\Java\jdk-17
macOS: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
For Build-Tools: Specify the build-tools folder without specifying the version. The tool will automatically find the latest one. For example:
Windows: C:\Users\Admin\AppData\Local\Android\Sdk\build-tools
macOS: ~/Library/Android/sdk/build-tools
If the paths are correct, the tool will detect the utilities and give the green light.
Part 5: Creating a New Keystore
If you don't have your own keystore yet, now is the time to create one.
The tool has a Create New Keystore button. Click it, and a window with a bunch of fields will open.
What to fill in:
· Имя файла keystore. Например myapp-release.jks. Расширение .jks обязательно.
· Пароль keystore. Это пароль на сам файл. Не теряй и не забывай.
· Псевдоним ключа (Key Alias). Имя для конкретного ключа внутри хранилища. Можно просто mykey.
· Пароль ключа. Может совпадать с паролем keystore, а может быть другим. Запоминай оба.
· Срок действия (Validity). Ставь 25–30 лет. Меньше не надо — потом будет головная боль с переподписанием.
· Информация о сертификате. Это данные, которые попадут в сертификат. Обычно заполняют:
· Country Code (C): RU
· State (ST): Moscow
· Locality (L): Moscow
· Organization (O): твоя компания или имя
· Common Name (CN): твоё имя или название приложения
После заполнения жмём Create. В указанной папке появится файл .jks.
Часть 6: Используем существующий keystore
Если keystore уже есть, не надо создавать новый.
Жмём Select Keystore, выбираем файл .jks. Вводим пароль keystore, псевдоним ключа и пароль ключа. Инструмент проверит, что всё подходит.
Часть 7: Подписываем APK
Теперь самое главное — сам процесс подписи.
7.1. Выбираем APK НажимаемSelect APK File, находим наш собранный, но ещё не подписанный APK.
7.2. Указываем выходной файл Лучше сохранить подписанный APK под другим именем,чтобы не перезаписать исходник. Например app-release-signed.apk.
7.3. Выбираем версию подписи Тут есть варианты:
· V1 (Jar Signature) — старый формат, совместим с Android 4.4 и ниже.
· V2 (APK Signature Scheme v2) — новый формат, быстрее, безопаснее. Работает с Android 7.0 и выше.
· V3 — добавляет поддержку ротации ключей, но редко где нужно.
· V4 — для стриминга APK, в обычной жизни не нужен.
Рекомендую ставить V1 + V2. Так приложение будет работать везде, и на новых версиях Android будет использоваться быстрый V2.
7.4. Жмём Sign APK Если всё хорошо,через несколько секунд появится сообщение об успехе.
Часть 8: Zipalign — выравниваем APK
После подписи надо сделать zipalign. Это утилита, которая выравнивает данные внутри APK, чтобы приложение быстрее загружалось и меньше жрало память.
Важный момент: zipalign делают после подписи. Если сделать до, подпись сломает выравнивание.
В инструменте есть отдельная вкладка или кнопка для zipalign.
· Выбираем подписанный APK.
· Указываем выходной файл (например app-release-signed-aligned.apk).
· Жмём Zipalign.
Готово. Теперь APK можно загружать в Play Store.
Часть 9: Проверяем подпись
Чтобы убедиться, что всё сделано правильно, можно проверить подпись командой apksigner.
```
apksigner verify app-release-signed-aligned.apk
```
Если ошибок нет — всё ок.
Часть 10: Где этот инструмент не нужен
Если ты работаешь в Android Studio и используешь Gradle, подпись можно настроить прямо в build.gradle. Это даже удобнее — всё автоматизировано.
Пример для Gradle:
```
android {
signingConfigs {
release {
storeFile file("myapp-release.jks")
storePassword "password"
keyAlias "mykey"
keyPassword "password"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
}
```
Но если Gradle не настроен, или нужно подписать APK, собранный кем-то другим — Android APK Signing Tool v2 спасает.
Часть 11: Мои грабли
Грабли 1: Забыл, где лежит keystore. Искал полдня, перерыл все папки. Теперь храню в отдельном месте и дублирую на флешку.
Грабли 2: Перепутал пароль keystore и ключа. Вводил одно, а надо было другое. Пришлось пересоздавать ключ.
Грабли 3: Попытался сделать zipalign до подписи. Подписал после — получил битый APK. Потом прочитал документацию и понял порядок.
Грабли 4: Использовал отладочный ключ для релизного APK. В Play Store такое не принимают. Пришлось переподписывать.
Грабли 5: Не проверил подпись после zipalign. Выложил в стор, а потом обнаружил, что подпись слетела. Приложение не обновлялось у пользователей.
Итог
Android APK Signing Tool v2 — удобная штука, когда нужно быстро подписать APK без танцев с бубном. Он берёт на себя всю работу с jarsigner, apksigner и zipalign, оставляя тебе только выбор файлов и ввод паролей.
Главное — не забывай про keystore. Это твой цифровой паспорт. Потерял его — потерял приложение.