How to Edit an APK File (with Images)

Table of contents:

How to Edit an APK File (with Images)
How to Edit an APK File (with Images)
Anonim

This article explains how to edit the content of an APK file. In order to perform this type of modification, you must first decompile the file (and then recompile it) using the APKTool program on your computer. To be able to edit an APK file, knowledge of Java and the Windows file system and Android operating system is required. This is a procedure that should only be performed by experienced users.

Steps

Part 1 of 3: Install APKTool

Edit APK Files Step 1
Edit APK Files Step 1

Step 1. Install the Java Development Kit (JDK)

You can download it from this URL:

Edit APK Files Step 2
Edit APK Files Step 2

Step 2. Install the Android SDK software

This is the software development environment for Android devices. In order to decompile and compile an APK file, you will need to install the Android Software Development Kit (SDK) program on your computer. The easiest way to perform this step is to install Android Studio by downloading it from this link.

Edit APK Files Step 3
Edit APK Files Step 3

Step 3. Create a new folder on your computer desktop

It will be the directory where you will save the APKTool installation files and the APK files to edit. Follow these instructions to create a new folder:

  • Click on an empty spot on the desktop using the right mouse button;
  • Select the option New one from the context menu that appeared, then choose the item Folder.
Edit APK Files Step 4
Edit APK Files Step 4

Step 4. Rename the folder with the name "APK"

To perform this step click on the newly created folder with the right mouse button and choose the option Rename. At this point, type "APK" and press the "Enter" key.

Edit APK Files Step 5
Edit APK Files Step 5

Step 5. Click on this link with the right mouse button and choose the option Save link as.

A new dialog will appear allowing you to choose where to save the "apktool.bat" file.

Edit APK Files Step 6
Edit APK Files Step 6

Step 6. Go to the "APK" folder you created on your desktop and click the Save button

Use the pop-up window to select and open the "APK" directory you just created on your desktop, then click on the button Save. In this way, the "apktool.bat" file will be downloaded and stored in the "APK" folder.

Edit APK Files Step 7
Edit APK Files Step 7

Step 7. Download the "apktool.jar" file

Follow these instructions to download:

  • Visit the site https://ibotpeaches.github.io/Apktool/ using the browser of your choice;
  • Click on the link Download for the latest version of the program listed in the "News" section.
Edit APK Files Step 8
Edit APK Files Step 8

Step 8. Rename the "apktool.jar" file

Most likely, the file you just downloaded will have the version number in the name. To delete it, you will have to rename it by clicking on the corresponding icon with the right mouse button and selecting the option Rename. Type the word apktool to use as the new file name. At this point, the full name should be "apktool.jar". By default, files you download from the web are stored in your computer's "Downloads" folder.

Edit APK Files Step 9
Edit APK Files Step 9

Step 9. Copy the "apktool.jar" file and paste it into the "APK" folder

After renaming the file, click on the corresponding icon with the right mouse button and choose the option Copy or Cut from the menu that will appear. At this point, access the "APK" folder you created on the desktop, click on an empty spot with the right mouse button, then click on the item Paste. The "apktool.jar" file will be pasted into the "APK" folder.

Part 2 of 3: Decompile an APK File

Edit APK Files Step 10
Edit APK Files Step 10

Step 1. Copy the APK file to be decompiled into the folder of the same name on the desktop

APK files can be downloaded from the web using various sites. Alternatively, you can copy one of the APK files on your Android device by connecting it to your computer, using the supplied USB cable (the same one you normally use to recharge it) and unlocking the smartphone screen. Access the folder Download of the device and copy the APK file you want to modify, then paste it into the "APK" folder on the computer desktop.

Edit APK Files Step 11
Edit APK Files Step 11

Step 2. Open the Windows search bar and type in the keyword cmd

Normally, the Windows search bar is located to the right of the "Start" menu.

Edit APK Files Step 12
Edit APK Files Step 12

Step 3. Click the Command Prompt icon that appeared in the results list

It features a square black icon with a white command prompt inside.

Edit APK Files Step 13
Edit APK Files Step 13

Step 4. Access the "APK" folder using the "Command Prompt" window

To access a folder from the "Command Prompt", use the cd command followed by the directory name. For example, if after opening the "Command Prompt" window the current working folder is "C: / Users [username]>", to access the desktop you will need to use the following command: cd desktop. If you have created the "APK" folder on your desktop, you can access it using the cd apk command. At this point, the prompt displayed in the "Command Prompt" window should be "C: / users [username] desktop / apk>".

If you have created the "APK" folder elsewhere on your hard drive, use the cd / command to go directly to the root directory of the "C:" drive. At this point, use the cd command followed by the full path of the "APK" folder

Edit APK Files Step 14
Edit APK Files Step 14

Step 5. Type the apktool if command followed by the name of the APK file you want to edit

This will install the correct framework for the app under consideration.

For example, if the APK filename is "my_first_app.apk", you will need to use the following command apk if my_first_app.apk within the "Command Prompt" window

Edit APK Files Step 15
Edit APK Files Step 15

Step 6. Type the command apktool d followed by the name of the APK file to modify

The indicated file will be decompiled. The content of the APK file will be stored in a separate folder that will have the same name as the file and will be created in the "APK" directory. At this point, you will be able to perform any changes you wish to make to the content of the APK file. To modify some of the files in the folder you need programming knowledge.

Following the previous example you will have to type the command apktool d my_first_app.apk inside the "Command Prompt"

Part 3 of 3: Rebuild an APK File

Edit APK Files Step 16
Edit APK Files Step 16

Step 1. Open the Windows search bar and type in the keyword cmd

Normally, the Windows search bar is located to the right of the "Start" menu. After modifying the contents of the APK file you decompiled, you will need to recompile it in order to use it as a normal APK file.

Edit APK Files Step 17
Edit APK Files Step 17

Step 2. Click the Command Prompt icon that appeared in the results list

It features a square black icon with a white command prompt inside.

Edit APK Files Step 18
Edit APK Files Step 18

Step 3. Access the "APK" folder using the "Command Prompt" window

To access a folder from the "Command Prompt", use the cd command followed by the directory name. For example, if after opening the "Command Prompt" window the current working folder is "C: / Users [username]>", you will need to use the cd desktop command to access the desktop. If you have created the "APK" folder on your desktop, you can access it using the following cd apk command. At this point, the prompt displayed in the "Command Prompt" window should be "C: / users [username] desktop / apk>".

If you have created the "APK" folder elsewhere on your hard drive, use the cd / command to go directly to the root directory of the "C:" drive. At this point, use the cd command followed by the full path of the "APK" folder

Edit APK Files Step 19
Edit APK Files Step 19

Step 4. Type the command apktool b followed by the name of the folder that was created by the decompilation process of the original APK file

The new compiled APK file will be created inside the "dist" folder which you will find in the directory that was created by the decompilation process of the original APK file.

For example, if the app you are working on is called "my_first_app.apk", you will need to type the command apktool b my_first_app.apk into the "Command Prompt"

Edit APK Files Step 20
Edit APK Files Step 20

Step 5. Create a new folder named "Signapk" directly on the desktop

To perform this step, click on an empty spot on the desktop using the right mouse button, select the option New one from the context menu that appeared, then choose the item Folder. Click on the newly created folder with the right mouse button and choose the option Rename, then type in the name "Signapk" and press the "Enter" key.

Edit APK Files Step 21
Edit APK Files Step 21

Step 6. Copy the newly compiled APK file into the "Signapk" folder

The new APK file is stored in the "dist" folder present in the directory that was created by the decompilation process of the original APK file. Click on the APK file with the right mouse button and choose the option Copy, then go to the "Signapk" folder and paste the APK file into the directory.

Edit APK Files Step 22
Edit APK Files Step 22

Step 7. Click on this link to download the file SignApk.zip.

This is the file you need to digitally sign the new APK file you created.

Edit APK Files Step 23
Edit APK Files Step 23

Step 8. Extract the contents of the "SignApk.zip" archive into the "Signapk" folder

At the end of this step, inside the "Signapk" folder you will find the "certificate.pem", "key.pk8" and "signapk.jar" files.

Edit APK Files Step 24
Edit APK Files Step 24

Step 9. Access the "Signapk" folder using the "Command Prompt"

Run the cd / command to return to the root folder of your hard drive, then type the cd command followed by the full path to the "Signapk" folder and press the "Enter" key.

For example, if you have created the "Signapk" folder on your computer desktop, at this point, the "Command Prompt" window prompt will be "C: / users [username] desktop / Signapk>"

Edit APK Files Step 25
Edit APK Files Step 25

Step 10. Type the command java -jar signapk.jar certificate.pem key.pk8 [APK_filename].apk [APK_filename] -signed.apk inside the "Command Prompt"

Replace the parameter "[APK_filename]" with the real name of your APK file that you recompiled. The digitally signed APK file will be created inside the "Signapk" folder. This is the file you will need to use to install the corresponding app on your Android device.

Recommended: