Время на прочтение3 мин
Количество просмотров11K
Короткий практический пример как разобрать apk приложение, что-то в нем изменить и собрать обратно в среде windows без использования android studio. Статья подойдет для новичков, сложного ничего не будет. Будем изменять (русифицировать) не полностью русифицированное приложение для видеокамеры ordro pro ep8.
На написание статьи подтолкнула другая статья на Хабр — habr.com/ru/articles/780694
Однако там описано, на мой взгляд, недостаточно подробно, новичкам будет тяжело. Кроме того, в приведенной статье использовались средства сборки-разборки под Linux, здесь будет windows-вариант.
В качестве цели для исследования будет выступать мобильное приложение в формате apk для камеры ordro pro ep8.
При эксплуатации это приложение демонстрирует вполне разумную локализацию, но в некоторых моментах все-таки «проглядывает оригинал» на иностранном языке:
Разбираем apk.
Самое простое, что можно сделать на старте — просто переименовать apk в zip и посмотреть на получившийся архив приложения:
Такой трюк позволяет сформировать общее представление о приложении, но не более. В своем содержимом файлы все равно будут иметь нечитаемый код:
Поэтому понадобится утилита apktool.
Устанавливать (инсталлировать) ее не нужно, только положить рядом с apk. Может также потребоваться java.
Проверить, установлена ли java можно так:
Далее команда apktool d com-ordro.apk полностью разберет приложение:
После этого можно наблюдать в том числе smali, о которых говорилось в уже упомянутой статье:
Файлов много, найти текст, который хотелось русифицировать, непросто. Поэтому пойдем по пути наименьшего сопротивления. Возьмем скриншот иероглифа из картинки приложения, переведем в текст и поищем этот текст по всем файлам в папках:
Как не сложно догадаться для каждого языка имеются соответствующие папки, в одной из которых и нашелся иероглиф. Нас интересует «папка для русского языка» (values-ru):
В файле находим частично непереведенные названия вкладок, кнопок и т.д. Изменяем текст на правильный:
Не лишним будет заглянуть в иные, рядом расположенные файлы:
Собираем обратно в apk.
После того, как все необходимые изменения внесены, можно приступить к сборке нового apk.
Сборка apk осуществляется также apktool командой apktool b com-ordro, где в качестве аргумента — папка с файлами, в которых происходили изменения.
Готовый файл apk будет в папке dist:
Однако, если данный файл перенести на мобильный и попытаться установить — попытка завершится неудачей. Необходимы дополнительные манипуляции с файлом apk перед переносом.
Необходимо выполнить выравнивание содержимого apk (aligning) и его подпись (sign).
Здесь частично будут использованы сведения из статьи medium.com/@sandeepcirusanagunla/decompile-and-recompile-an-android-apk-using-apktool-3d84c2055a82
Но так как, сведения из статьи немного устарели, как например, в части алгоритма шифрования, будут использоваться немного иные команды.
Алгоритм следующий.
1.Создаем ключ-пару, который «подпишем» наш apk:
keytool -genkeypair -keyalg DSA -keysize 2048 -keystore my-release-key.keystore -alias alias_name -validity 10000
Пароль можно задать любой как и данные, ввод которых можно пропускать, нажимая enter.
На выходе рядом с apk появится файл — ключ-пара:
2. Подпишем файл(signing), используя нашу ключ-пару.
jarsigner -verbose -sigalg SHA256withDSA -digestalg SHA256 -keystore my-release-key.keystore com-ordro.apk alias_name
В терминале увидим при успешном выполнении примерно следующий вывод:
Однако, если проверить подписанное приложение jarsigner -verify -verbose -certs com-ordro.apk может выскочить ошибка, которая в дальнейшем не позволит установиться приложению на мобильном:
Можно пойти по длинному пути и исправить ошибку с ключ-парой и сертификатами, но мы поступим проще. Подпишем и выровняем apk с помощью uber-apk-signer.
Скачав uber-apk-signer.jar в папку с готовым apk, выполним команду:
java -jar uber-apk-signer.jar -a com-ordro.apk
*Данная команда заменяет собой 2 предыдущих шага с выравниванием и подписанием.
Она использует все тот же zipalign.exe и создает ключ-пару. Если zipalign нет, то его нужно скачать и добавить его в PATH.
На выходе получим готовый apk, который уже можно устанавливать на мобильном:
Результат:
Спасибо за внимание.
Приложение до и после, а также файлы для работы можно скачать — здесь.
ps. для тех кого интересует вопрос (как и меня) собственно по камере — можно ли с нее получать поток, в обход мобильного приложения — да, возможно rtsp:\\192.168.1.1:554
APK Editor Studio v1.7.2
- Fixed manifest parsing for newer Apktool versions.
- Fixed AAPT 1/2 switch for newer Apktool versions.
- Fixed regular expression search by whole match.
- Added word wrap support to code editor.
- Added font configuration to code editor.
- Added Android 14 and 15 support.
- Added Luri (Bakhtiari) translation.
- Added Ukrainian translation.
- Added Vietnamese translation.
- Updated default Apktool to 2.11.0.
- macOS: Fixed minimum version to be 10.13 (High Sierra).
APK Editor Studio v1.7.1
- Added support for optimizing shared libraries.
- Added Arabic translation.
- Added Spanish (Mexican) translation.
- Fixed Apktool update loop when Java is not found.
- Windows: Improved Java path detection.
APK Editor Studio v1.7.0
- Added automatic Apktool updater.
- Added framework manager.
- Added global Find and Replace.
- Added code search case sensitivity option.
- Added code search by regular expression option.
- Added syntax definition downloader.
- Added ability to open resources in an external app.
- Added ability to disassemble only main DEX classes.
- Added ability to disassemble without debug info.
- Added progress indication for APK cloning.
- Added Android 13 support.
- Added Swedish translation.
- Updated default Apktool to 2.7.0.
- Updated Android SDK Build Tools to 33.0.1.
- Fixed error while saving the currently open resource.
APK Editor Studio v1.6.0
- Added Smali syntax highlighting.
- Added Find and Replace features to code editor.
- Added code folding.
- Added code indentation control (Tab, Shift+Tab).
- Added custom dark theme for all platforms.
- Added stand-alone version of Android Explorer.
- Added ability to filter resource tree.
- Added ability to build debuggable APKs.
- Added Android 12 support.
- Updated Apktool to 2.6.0.
- Migrated to a new syntax highlighter.
- Set AAPT2 as a default option.
- Remember resource tree columns state.
- Remove empty resource tree nodes.
- Improved Android Explorer window.
- Improved dynamic GUI translation.
- Fixed erroneous resource item deletion on open file.
- Added explicit warning for default keystore.
- Windows: Fixed WebP image format support.
- Windows: Changed default editor font to Consolas.
- Linux: Dropped DEB package.
- Linux: Updated Qt to 5.15.2.
APK Editor Studio v1.5.0
- Added APK cloning (experimental).
- Added signature viewer.
- Added command line parameters.
- Added ability to sign and optimize APK without unpacking.
- Added support for multi-window mode.
- Added support for system dark mode.
- Added support for relative tool paths.
- Added explicit toolbar customization.
- Added RTL UI support.
- Added Android 11 support.
- Updated Apktool to 2.5.0.
- Updated Android SDK Build Tools to 29.0.3.
- Added Azerbaijani translation.
- Added Chinese (Simplified) translation.
- Added Czech translation.
- Added English (British) translation.
- Added French translation.
- Added Hebrew translation.
- Added Hungarian translation.
- Added Indonesian translation.
- Added Italian translation.
- Added Korean translation.
- Added Kurdish translation.
- Added Persian translation.
- Fixed installation of an unsaved project.
- Fixed confirmation when closing modified tabs.
- Fixed crash on empty application title.
- Fixed potential duplicates in recent list.
- Windows: Added Explorer integration.
- Windows: Updated Qt to 5.15.2.
- Windows: Removed bundled Visual C++ Redistributable.
- macOS: Updated minimum version to 10.13 (High Sierra).
- macOS: Updated Qt to 5.15.2.
APK Editor Studio v1.4.0
- Added Android Explorer.
- Added AAPT2 support.
- Added ability to take screenshots.
- Added ability to set Java heap size.
- Added support for UTF-16 and UTF-32.
- Added Greek translation.
- Added Polish translation.
- Added Romanian translation.
- Added Turkish translation.
- Fixed GUI freezes and crashes.
- Fixed project modified state triggers.
- Updated QtKeychain to 0.10.0.
- Improved Key Manager layout.
- macOS: Updated minimum version to 10.11 (El Capitan).
- macOS: Updated Qt to 5.11.2.
- Linux: Improved image format support.
- Linux: Released first AppImage package.
APK Editor Studio v1.3.1
- Updated Apktool to 2.4.1.
- Added support for Android 10.
- Windows: Fixed missing icons.
APK Editor Studio v1.3.0
- Added Permission Editor.
- Added ability to keep broken resources.
- Added ability to specify path to Java.
- Added German translation.
- Added Japanese translation.
- Added Portuguese translation.
- Added Spanish translation.
- Added sorting to title editor.
- Improved code editor layout.
- Improved handling of tool paths.
- Fixed adaptive icon bug on bulk replacement.
- Fixed Validity field on key store creation.
- Made JKS a default key store type.
- Changed loading animation to spinner.
- Windows: Updated Qt to 5.13.2.
APK Editor Studio v1.2.0
- Added support for WebP image format.
- Added support for activity icons.
- Added ability to remove resources.
- Added ability to sort resource tree.
- Added taskbar blinking / dock bouncing.
- Added button to instantly copy log text.
- Improved sorting by DPI.
- Fixed project status badge bug.
- Fixed resource replacement bug.
- Windows: Updated Qt to 5.12.3.
APK Editor Studio v1.1.0
- Added round icons support.
- Added TV banners support.
- Added API selection dialog.
- Added line numbers in code editor.
- Added «What’s New» in the update dialog.
- Added «DPI» column to the resource inspector.
- Added current line highlighting in the code editor.
- Updated Apktool to 2.4.0.
- Display uniform-sized thumbnails in the icon list.
- Display system file icons for non-graphical thumbnails.
- Display tab titles without a bulky GUID prefix.
- Improved drag and drop from external sources.
- Improved code editor «Unsaved» state after undo.
- Improved minor GUI details.
- Windows: Updated Qt to 5.12.2.
- Windows: Compiled OpenSSL to match VC versions.
Сделать вклад
Исходный код
APK Editor Studio — проект с исходным кодом, доступный на платформе GitHub под лицензией GNU GPL v3.
Перевести
Помогите нам перевести APK Editor Studio на Ваш язык и расширить наше международное сообщество.
Связаться с нами
Не стесняйтесь обращаться к нам: задавайте вопросы, сообщайте об ошибках, предлагайте Ваши улучшения и идеи.
Пожертвовать
Мы рады любым пожертвованиям. Поддерживая APK Editor Studio, Вы помогаете сделать программу лучше.
-
#1
Ищу приложение, для того чтобы открыть АПК файл и изменить интерфейс
Решение спустя 3 часа нашел
Просто откройте ваш apk с помощью любого архиватора (7zip)
Последнее редактирование:
-
#2
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Long back in 2016, we published a detailed tutorial on compiling and decompiling APK files using APK Easy Tool. Today, we’ve come up with another utility that lets you compile and decompile APK files even more easily and it’s simply called ‘apktool’, a Java-based tool that works on Windows, Linux, and MacOS. In this apktool tutorial, we’ll see how to use apktool to compile APK from a modified source, decompile APK, edit and recompile APK files, and make an Android app package.
APK modding is quite common in the Android world. By modding an APK file, you can add or remove features from an App, sign it with your own key, change the UI design or theme the UI and add custom translations. APK modding can also be potentially used to inject malicious code inside an App. This is the reason why special care must be taken when installing modified APKs from third-party sources. In this article, we will discuss the basics of how to manipulate an APK to apply modifications to it.
In order to do any sort of modification to an Android APK file, you must first decompile it, edit its contents and then compile it back. Currently, the easiest way to do this is using a special desktop PC tool known as apktool. Apktool is a Java-based utility which can run on Windows, MacOS, and Linux with minimal effort. Once it is set up, it can decompile or compile an APK file with a single command.
Warning
Modifying APK files might cause them to become unstable and/or unusable. Be extra cautious when manipulating system APK files, as a wrong change might render your device inoperable. DroidViews does not support in any way modifying APK files to add malicious code in them. This process is strictly prohibited by law.
Set up Requirements
Before you can follow our apktool tutorial, there are a few prerequisites you need to take care of. The only requirement of apktool is Java version 1.8 or greater. You can check if you have Java installed on your machine by opening a command prompt on Windows (click the Start Menu, type cmd.exe and hit enter) or a terminal on MacOS/Linux and giving the command
java -version
If this command returns 1.8 or greater, you are good to go. If not, you need to install Java first. You can get Java for your machine here.
Download and Set up apktool
You can download the latest version of apktool by clicking on this link. When the download is finished, rename the file to apktool.jar. You will next need to download a wrapper file, depending on your desktop Operating System. You can get the wrapper file by using the following links. For your convenience, right click on the link and select ‘Save As’.
Save the file as apktool.bat on Windows and apktool on MacOS/Linux:
- Windows
- MacOS
- Linux
Also, download the ADB and Fastboot files for Windows, MacOS, and Linux.
Finally, you will need to move both the apktool and wrapper files to a special location so they can be executed everywhere on the system: On Windows, this location is C:\\Windows . On MacOS and Linux, place them under /usr/bin or /usr/local/bin (root required). If you are on Linux or MacOS, make sure that both files have the execute permission set.
To test that everything works as expected, open a command prompt on Windows or a terminal emulator on MacOS and Linux. Then issue the command apktool and hit enter. You should get an output similar to the following:
apktool Tutorial to Edit APK Files
We will cover only the basics of APK file manipulation. This only includes decompilation and compilation. Anything else lies outside of the scope of this article and should be covered in a separate writing.
Decompile, Edit and Recompile APK Files
First, download the APK file which you need to decompile and edit. In this guide, we will be using the Facebook Lite App APK as an example. You can download it here.
Next, open a terminal emulator or command prompt inside the folder you downloaded the APK file to. To do this on Windows, navigate to the folder using Windows Explorer and then type CMD in the address bar as shown below. Hit enter and a command prompt window will open.
Decompiling an APK file is quite simple. You just need to issue a command in the following form:
apktool d <APK filename>
For the Facebook Lite App, this will get into:
apktool d facebook_lite_v118.0.0.9.94.apk
Apktool will create a new folder with the same name as the APK file and place all the App data inside it.
The new folder will have a structure similar to the following:
- The res folder contains everything that has to do with translations and user interface layout.
- The smali folder contains App source code in the smali form. Smali is a language type similar to assembly. To make any changes apart from cosmetic ones to an App, these are the files you need to mess with.
- The unknown folder contains everything else that comes packaged inside the APK file but does not follow Google’s guidelines for APK packaging.
- Lastly, AndroidManifest.xml is the Manifest file. This contains information like the App name and characteristics, the Intents it listens to and the Permissions it uses.
Compile APK from a Modified Source
Compiling a modified source with apktool is as simple as decompiling. You can get the job done by just issuing a command in the form:
apktool b <app_source_path>
In our example with the Facebook Lite App, this will get into:
apktool b facebook_lite_v118.0.0.9.94
That is all you need to know if you want to compile and decompile APK files for Android. Stay tuned for special guides about manipulating App icons and colors and adding or removing functionalities to your apps! Try it now and let us know if you were able to decompile and compile an APK. I just hope our apktool tutorial will help you edit APK files yourself.
Reader Interactions