How to remake an android application. Basics of editing Android system applications (apk)

This is me again and my instructions for teapots and coffee pots with pictures.

This time I will go into detail about the replacement system components Android OS on the example of installing a modification of the status bar.

Android is a small Linux. It is necessary to follow a number of rules when replacing files so that the phone does not turn into a brick, which can only be revived by a complete flashing with the loss of all data from the internal memory of the device. Internal partitions are formatted in a file system other than FAT32 on flash drives. The file properties, among other things, store permissions for different user groups (file owner, file owner group, other users). When operating with system files they must be saved, because at boot the system may simply not be able to access them and not boot normally.
Let's start with the toolkit.

We will need:

  • A file manager that knows how to work with root rights and file permissions. Root Explorer is best (you bought it, right?)
  • The modified file itself, which we want to put in place of the system one (link at the end of the article).

Now we use one of the convenient functions of Root Explorer. Let's make a long tap on desired file to bring up the context menu

And click on the item " Zip this file" to save the file in a zip archive on the SD card. After zipping, we will receive the following message:

Press the button " stay" to stay in the folder and do one more thing.

Now everything is ready to replace the file.
I have already talked about the access rights for each file. To recreate them on a new file, you must first look at them from the old one. They are represented by a series of characters "rwxrwxrwx ". 1st triad - owner's rights, 2nd - owner's groups, 3rd - all other users. Our file has "rw-r--r--" permissions.

Now go to the SD card, find the modified file there and select the item " Copy", but we are not in a hurry to immediately select the folder " / system / app", because we will immediately damage the system. Instead, we copy the file to a special folder for temporary files " / data / local / tmp ", to bring the file into a form that will take system.
First, call the context menu of the file and select the item " Rename" and enter the file name " SystemUI.apk". That's right, because on Linux the case of the letters in the name matters, i.e. " systemui.apk" and " SystemUI.apk" Are different files.
Next, you need to change the permissions on the file, because now they are almost certainly set incorrectly. To do this, again call the context menu of the file with a long tap and select the item " Permissions". For our "rw-r--r--" value, the flags should be set like this:

Press " OK" and call the context menu again. Now we need to change the owner and group for this application. To do this, select the item " Change Owner". A window will appear with information about the current owner of the file.
Here it is necessary to make a small digression.
In the folder "/system/app " all files are owned by the user "root" (uid=0) and the group "root" (gid=0), and in the folder "/system/framework" the user "system" (gid=1000) owns and the "system" group (gid=1000).
Based on the foregoing, we set desired values and press " OK".
And for the third time we call the context menu for the file and select the item " Copy" and in the copy dialog go to the folder " / system / app". Now boldly click " paste"and read on carefully.
Almost immediately, the system will report that the status bar process has suddenly ended and will offer to start it. All attempts will fail. Between the appearance of windows, you need to have time to do a number of actions. Before pressing the button, you need to call the menu for turning off the device, it will appear under a warning. Now you need to place your finger approximately on the left side of the button. Now you need to very quickly click three times with your finger in order to have time to close the warning, select the shutdown item and confirm your intentions.
Now we are waiting for the phone to turn off, restart it and enjoy the result or not enjoy it and look for errors.

Apk editor pro, which you can download for android on our website, will allow you to hack / change the contents of the files of any application for mobile devices and customize it to your liking.

Peculiarities

The program is a professional utility that in the hands of advanced users can become a powerful tool for editing applications for android. The functionality is practically the same software for personal computers.

What can this utility do?

  1. Change (translate) the names of other applications.
  2. Change architecture layouts, colors, patterns graphic settings(for example, icon size).
  3. Change sound design, media files.
  4. Remove ads.
  5. Bypass paid content blocking.
  6. Move the application from the internal memory of the device to the SD card.
  7. Change resolution and more.

To understand how to use the utility, you need to download apk editor pro and go to the menu. Then choose either installed application on android, or its apk file. After that, by default, data will be opened that the user can change:

  • resource editing;
  • file replacement;
  • general editing;
  • data editing.

The program will prompt you to install the modified version. It doesn't work in all cases, so old version must be removed manually and a new one installed. After uninstalling, select the apk editor folder (for convenience, you can use ES Explorer) among the programs on android and find the modified application file, install it on the device.

The program has a user-friendly interface. Navigation is quite simple, but the user needs to have a basic knowledge of English to get it right.

Advantages and disadvantages

  1. The program offers the user a wide range of options for customizing applications.
  2. There is a Help section in the menu, which simply and in detail describes a large amount of the editor's program features. Therefore, users who are far from programming will not have to look for examples and editing instructions on third-party resources.
  3. You can download the program for free from our website.

Using this utility requires some skills and knowledge. In the hands of an inexperienced user, editing can lead to violations of the integrity of the file system, which will eventually lead to application crashes. In the menu in the Help item there are examples of conversion with pictures and tips for correct apk usage editor pro for android. Therefore, if you want to deal with this program, just follow the instructions.

The editor is a rather useful tool for those who are faced with an inconvenient application interface (lack of Russian language, constant advertising, banners, etc.). If you have already used this program, share your impressions below in the comments.

APK is the format used by the Android operating system for archive executable application files. An analogue, for example, in Windows is .msi, in Symbian - .sis, in Linux - .rpm or .deb. In this article, we will deal in as much detail as possible with all issues regarding this file format.

The process of disassembling, editing and assembling the "correct" is called reverse-engineering ("reverse engineering"). What is needed for this? The following tools are required:

Apktool. It is more convenient to use it with the SmartApktool shell, you can also use ready-made batch files, such as ApktoolBAT.

Notepad++ - Not required, but highly recommended.

7zip or WinRar, or any other archiver program, but one of these is recommended.

Deodexed firmware.

There are several ways to install applications on the Android operating system. The first one, which is also the main one, is directly through Google Play(Android Market), that is, from an official source, which will require a Google account. Many applications are paid, if you do not want to look for a hacked version on pirate sites, you will have to pay for the purchase. But we'll talk about how to do this in. The second is from unofficial sources other than Google Play, for which you will have to enable the "Allow installation of applications from unofficial sources" option in the settings of your smartphone or tablet, after which the APK installation file must be written to a memory card.

It is also possible to install in bulk apk apps. This will require Astro file manager- a special file manager. After installing it, move the applications:

From smartphone/tablet: in mntsdcardackupsapp(in other words, a memory card, then the backups folder, the app folder)

From a personal computer (do not forget to enable the connection of an Android device in simple USB storage mode): sd cardbackupsapp

Then open the desired application, in context menu select "Application Manager" and go to the "Backups" tab, where we select "Make a long click or check the application to install." Click the "Install" button - all applications will be installed on your device.

What is the structure of the APK file is easy enough to see. Open the desired APK using an archiver program, for example, WinRar. Here's what we see inside:

AndroidManifest.xml is a kind of “passport” that describes what is in the application, including: system requirements to the application, its structure and version.

META-INF- the folder containing the file MANIFEST.MF(you can open it with almost any text editor, Notepad++ is recommended), opening which you can see SHA-1 checksums and data paths, the Manifest-Version standard version, RSA or DSA certificate files, the SF file contains paths to various resources and their checksums . In general, META-INF are metadata files, that is, data about data.

res- a folder that contains all the resources of the "software stuffing", sorted into subfolders. For example, the ~drawable~ folder contains graphical elements of applications (different statuses, icons, etc.), the layout directory contains XML files that specify the placement of graphical user interface (GUI) elements.

classes.dex- program code to be executed virtual machine DalvikVM. Recall that the Android operating system is a mixture of the Linux kernel with the Java virtual machine.

resources.arsc- compiled XML file. It contains data about all resources used by the program.

assets- a folder that also contains various resources, it may not be in the APK at all.

lib- a folder that contains "libs" or, more simply, native libraries, if the program is written using the NDK, for example, with elements when C ++. This directory may not be in the APK.

com- may not be in the APK.

org- may not be in the APK.

udk- may not be in the APK.

We have dealt with the contents of the APK application, now let's proceed to its detailed disassembly. For decompilation, you will need Apktool and Java, as well as the actual APK file itself. Apktool is recommended to be unpacked into a directory C:WINDOWS(this is not necessary, but it will be more convenient. Why - read a little below).

To launch Apktool, you need to enter the "Run" menu of your computer. On Windows XP, click Start -> Run, on Windows 7: Task Manager ( ctrl+Alt+Del), at the top in the dropdown menu File -> New Task (Run...), or just call it with a keyboard shortcut Win+R.

Calling command line- we write cmd, after which we launch Apktool - we write apk tool(for this it was necessary to place it in WINDOWS folder). Further, all control occurs through the command line using parameters.

If there is no desire to bother with constant input text commands, you can use a graphical interface - for example, the mentioned SmartApkTool. Run SmartApkTool.exe, then in the Unpack / Pack tab select the desired APK application (it is important that the file name does not contain spaces, Cyrillic, special characters and punctuation marks).

After unpacking, the program will create a folder with the same name as the APK file. Inside it will be all the content of the application.

APK can also be localized. Before we start doing this, we launch the previously installed Notepad++ and set it up as follows. We open Settings -> Configuration -> New Document.

After the done actions, open the unpacked (decompiled) application, folder res/values.

All localizations are often in the file strings.xml, but sometimes some of them may be contained in arrays.xml. Copy these files, create in a folder res folder values-en and paste them into it.

Now you can open strings.xml using Notepad++, translate, and save the modified file.

In file AndroidManifest.xml you can specify where to install APK applications. Please note, this is only for android versions 2.2 and newer. So, open the specified file using Notepad ++. Almost at the very beginning, you can see the parameter:

Here you can specify the following options(after the "=" symbol):

internalOnly– the application will be installed only in the internal memory of the device

auto- gives the user the choice to install the application during internal memory or to a memory card

preferExternal– the program will be installed on the memory card. Please note that not all applications will work correctly if installed on external storage, or not work at all. These include:

Services i.e. services

Alarm Services– services that use time, such as alarm clocks

Input Method Engines– input applications, including different keyboards

Live Wallpapers- "live" animated wallpaper

liveFolders- respectively, animated directories

AppWidgets- various widgets

accountmanagers– managers of different accounts, including ICQ clients, clients for social networks and so on

Sync Adapters– programs that require constant synchronization

deviceAdministrators– applications that are used for administration

Copy Protection– Applications that are protected from copying.

In the application, you can edit and replace with your various icons and graphic elements of the user interface. To do this, open the folder res in the folder with the decompiled APK application, here you can see the folders:

drawable hdpi

drawable-ldpi

These folders contain all the icons and other graphic elements of the program. The letter before "dpi" means the size of the graphic elements, respectively:

hdpi- high density dots per inch, size 72x72 pixels

mdpi- average density of dots per inch, size 48x48 pixels

ldpi- low dpi density, 36x36 pixels

In order to change, for example, the application icon, open the file AndroidManifest.xml using the Notepad ++ program, look for the line in which the icon is indicated, look at its exact name (note that the file extension is not written, only the file name).

Open the appropriate folder drawable-*dpi, insert the edited or new icon, do not forget to double-check the original name in AndroidManifest.xml. The picture must be in .png format and have exactly the same point density as original file, for example for hdpi it's 72x72 pixels.

If you want to replace the name of the icon with your own, then save the picture with the desired file name in drawable-*dpi, after which we specify exactly the same name in AndroidManifest.xml(for example android:icon="@drawable/test"). In the same way, you can change any other graphic elements, but the requirements are the same - the .png extension and the dpi density are required, as in the original file.

In the unpacked application, you can double-check what rights it has. This is useful if the APK was installed from an unknown source, and so that a flashlight or a beautiful calendar does not suddenly start sending paid SMS messages to an unknown number. We open AndroidManifest.xml Notepad++ program and look for the corresponding lines. For sending text messages, for example, the parameter answers SEND_SMS. You can read more about all the rights that an application can have in .

Installed APK applications can be extracted from the system. This can be done in several ways. First, you can install Astro File Manager. Open the application, and then select the "Application Manager" item in the context menu. We are looking for the necessary application, mark it with a checkmark and make a backup copy. After the processing, the selected application will be located along the path:

mntsdcardackupsapp

sdcardackupsapp

Next, you can use Root program uninstaller. After launch, the application will automatically determine everything installed APKs and automatically backup all of them. Accordingly, you can, if desired, copy for further decompilation these backups, they are on the path:

mntsdcardRootUnistallerautobackups(when viewed directly from an Android device)

sdcardRootUnistallerautobackups(when viewed through a computer, while the Android device is connected as a USB storage device).

Another way is to use Root Browser Lite, of course, you will need Root rights for this. We open this application, we pass along the path:

systemapp(If you are interested in system applications).

We copy the necessary applications to the memory card, after which you can perform any manipulations with them.

You can also download the APK apps you are interested in from Google Play (Android Market) directly to Personal Computer. This requires a browser. Google Chrome(version 17 or higher), and the plugin for it is APK Downloader. After downloading and installing the specified plugin, we create a copy of the Google Chrome browser shortcut, where we write the following line after the space:

-ignore-certificate-errors

With the standard browser installation path, the line should look like this:

"C:Program FilesGoogleChromeApplicationchrome.exe" -ignore-certificate-errors

After that, in the dialer of the smartphone, enter:

*#*#8255#*#*

We rewrite the Device ID, which consists of 16 characters. Open Google Chrome using the created shortcut with the specified parameter -ignore-certificate-errors, go to Tools -> Extensions(you can also enter “chrome://settings/extensions” into the address bar), open the APK Downloader plugin settings. In the options, enter the email address and password of your account google records, as well as the resulting Device ID. Now we go to Google Play (Android Market), open the page with the desired application, wait for it to be fully loaded. The APK Downloader icon will appear - after clicking it, the application will be downloaded to your computer.

From this article you will learn what an android application consists of, how to open APK file and with what programs.

What is an APK file?

APK - operating format Android systems, used for archive executable application files, and the name of the file itself can be anything, but the extension should only look like .apk. APK analogues in other operating systems are .msi in Windows, .sis in Symbian, .rpm or .deb in Linux.

Let's see what's inside
Basically the .apk is ZIP archive, so you can look at the internal device using any file manager or archiver, such as WinRAR or mobile application Xplore.





At the same time, it is worth remembering that you get only visual access to internal resources, editing options are extremely limited.
Consider the structure
Inside the .apk we see a number of files and folders, let's find out what they are for:
  • AndroidManifest.xml is a kind of "passport" of the application from which you can find out all the main points, requirements, version, permissions, and more.
  • META-INF this file contains metadata, i.e. data about data, checksums, data paths, resource paths and checksums, certificates. You can open this file with any text editor, but Notepad++ is recommended.
  • The res folder contains all program resources, graphical, such as icons, pictures, text, elements GUI. You can also easily access the folder.
  • classes.dex - the direct program code of the application executed by the Dalvik VM virtual machine, you can see what is inside this file only by decompiling the .apk, we will talk about this in other articles. resources.arsc - compiled XML file, this file contains data about all resources involved in the program.
  • lib - a folder with native libraries, the resources of which can be accessed only when using specialized programs. Also in the APK, there may be such files and folders as com, org, udk, but not always.

Now consider internal structure in more detail for this we need a decompilation program, Java and an APK file. The main tool for disassembling .apk is Apktool, but this program works only from the line, which is not very convenient. For faster and more convenient parsing, you can use APKing, it's still the same Apktool, but with the ability to work from the context menu.
And so we install APKing as any application for Windows and by selecting .apk we click on it with the right mouse button and at the same time Shift, after which we will see the following:


And we select the necessary action, for example, decompile completely, then the program will complete the operation and create a folder with the same name.


By opening the folder, we will have access to all the resources of the APK file.


Now all text files can be edited, while observing the basic rules, you can use popular program Notepad++, for example, consider AndroidManifest.xml

Editing system applications Android is most often carried out when the user of a smartphone, tablet or other device controlled by this operating system, ceases to satisfy the current appearance programs installed in the device by the manufacturer or seller. Another reason may be the need to make not only changes regarding the graphic design of Android applications, but also affecting the location of various elements and the performance of basic functions.

In order to make changes to the code, elementary programming skills are required in almost any language (preferably Java and C ++). To replace graphics, direct hands and the ability to work in a graphics editor will do.

First of all, you should decide whether you just need to replace the graphics in Android applications or whether you need to change the arrangement of elements in the system and make deeper changes in the code. Further steps depend on this, which involve either working with the application as an archive, or complete disassembly and editing.

Changing graphics in Android system applications

In order to simply replace or modify the original graphics (change button colors, redraw pictures, etc.), it is enough to have a standard WinRAR archiver on your computer. At the same time, the user must have “root” rights on the device (similar to account administrator on Windows), and it is also desirable to have an alternative recovery (CWM) and a root explorer (to access file system Android directly in the device itself).

First of all, you need to enable USB debugging in the device, then connect it to the computer using a USB cable and install the necessary drivers. They are usually located on virtual disk that appears when connected to a computer.

Then you also need to download the ADB plugin from the Internet for file manager. This plugin allows you to see the entire Android system as a connected drive with folders. All system applications are located at /system/app and /system/framework. Having found the desired application, simply copy it to your computer. If the plugin is not installed, you can use the root explorer to copy the application with the apk extension to a removable SD card, and then from it to your computer.

After copying desired application you can start editing graphics. By the way, all pictures in Android applications are saved in png format, which is easily opened by any graphic editor. By opening the application file with using WinRAR, you can see a number of folders. We will only be interested in the res folder, inside which, in turn, a lot of different folders will be found. Of these, only those that have the word "drawable" in their name are needed.

Now let's remember our device type and its screen resolution. If this is a smartphone, and the resolution is 240x320, then we will be mainly interested in the drawable and drawable-ldpi folders. If the resolution is 320x480 - the drawable and drawable-mdpi folders, respectively, and for the resolution 480x800 - the drawable and drawable-hdpi folders. In addition to them, there are usually also folders with the word "land" in their names - these are graphics for portrait mode, i.e. when the device is tilted.

If you have a tablet in your hands, then we will only be interested in the drawable and drawable-mdpi folders at any screen resolution.

By copying the selected folders to your computer, you can replace or recolor the original images with the desired and pleasing to the eye. You should pay special attention to pictures with a resolution of 9.png. The fact is that along the perimeter of such an image there is a special frame one pixel wide with special marks, the violation of the integrity of which will lead to a failure of the application. Therefore, extra care must be taken when editing such files.

After editing the folder, you need to upload it back to the archive, which is the application itself with the apk extension. In this case, it is necessary to select the “no compression” option in WinRAR.

The corrected application is downloaded back to the device either using the root explorer (first the file is copied to the SD card, and from it to the device), or after exiting the recovery - immediately from the computer to the / system / app or / system / framework folder . Next, you must set the file permissions using the appropriate options in the root explorer or the ADB plugin. They must be in 644 format. After rebooting the device, you can see the result of the updated application.

Editing the source code of system applications

A little more effort is needed to edit the source code of system applications. In order to disassemble and build the application after making changes to it, you will need to perform a few of the following steps.

1) Install the necessary software package on the computer in their latest versions: Java SE Runtime Environment and Android SDK Windows (programs for working with applications and their components), APKtool or APKManager or Firmware_tool (one of three programs for disassembling and decompiling system applications), NotePad ++ editor (for making changes to source Android system apps).

2) Enable "USB debugging" in the device, connect it to the computer using a USB cable, install the necessary drivers to work with the device.

3) Using one of the above programs for working with application code, you need to extract the folder / system / framework (completely) from the phone to the appropriate folder of the program and system applications from the / system / app folder. For example, for the Firmware_tool program, files from the phone must be copied to the C: Firmwaretoolfw_project1_source2_system.img_unpacked folder in the appropriate subfolders (applications to the app folder, files from the framework to the framework folder). When using both this and other programs, be sure to read the instructions for them.

4) Install the "reference framework", i.e. a set of rules in accordance with which decompilation (i.e. code disassembly) and compilation (i.e. code assembly) of applications will be carried out.

This completes the preparation for working with system applications.

Unloading applications from the device and loading them back is carried out similarly to the procedure described in the section “Changing graphics in Android system applications”.

Editing the code of Android applications is usually done using the NotePad ++ editor - one of the most convenient text editors, which have the syntax highlighting option for the selected programming language. As a rule, when editing, you can also change graphics along the way using the selected graphic editor.

Upon completion of editing, the modified application is loaded back into the device, and the device itself must be rebooted. More advanced editors for debugging applications before downloading them to the device use various emulators, for example, Eclipse from Google.

A computer