• Welcome Guest to the new PlayerSquared! Please be aware the site is a work in progress & we'd appreciate your help in letting us know which features from the old site we're currently missing as well as report any bugs you find via this thread here: Bugs/Missing Features
  • If this is your first visit You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Sign up today to get the latest PS4 GameSaves, Game Mods and much more!

APK file contains the following files

SyrenRemix

Reverse Engineer
Staff
October 25, 2020
400
2,877
93
3,013
Greetings, everyone. I have noticed that NGU phone Modding has not delved into the details of modding apps, so I have decided to create a tutorial to help those who want to learn how to modify apps. I will start with the basics for now, as server-sided apps are a bit more complicated.

Typically, an APK file contains the following files:
  1. AndroidManifest.xml: This file contains the application manifest, including the version number, version name, permissions, application name, application icons, activities, services, broadcasts, and other configuration information. It is like the brain of the app, and can be edited by changing, deleting, or adding elements.
  2. classes.dex: This file contains the Android code of the application. In the development of Android applications, if the developers write Java code, the code will be compiled into many class files, which are combined into the classes.dex file. Most of the Java codes of applications are in this file. Some APKs with bigger sizes may contain multiple dex files, such as classes1.dex and classes2.dex. Essentially, any Activity, Object, or Fragment used within your codebase will be transformed into bytes within a Dex file that can be run as an Android app.
  3. resources.arsc: This file contains the resource configuration, including the string, theme, picture file index, layout file index, and other information. This file is mostly encrypted, but can be viewed through APK editors or converted to res directly.
  4. res/: This folder contains resources such as pictures, layouts, menus, and other files. The indexed files in the resources.arsc are stored in this directory, except for resource confusion.
  5. assets/: This folder contains secondary resource folders, such as lib files, HTML files, pictures, videos, data like games, HTML, CSS, Java, media, fonts, TTF files, binary files, etc. The files inside will not be indexed in resources.arsc.
  6. lib/: This folder contains .so library files that are usually developed by C/C++. These files are used to run an app on a particular architecture device.
  7. META-INF/: This folder is not usually useful, as it is just for storing information about the signature. Certificates of an APK are stored in this folder.

Now, I will explain some important terms in modding:
(a) APK Clone: In the Android system, the package name is the ID of each application. After the application is updated, the name, the picture, and the interface may be changed. Only the package name cannot be changed. For different applications, their package names should be different. Otherwise, they will be considered the same applications. By changing the package name, you can install the same application twice or more on your device.
(b) Zipalign: Zipalign is an archive alignment tool that provides important optimization to Android application (APK) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the APK, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application. This tool should always be used to align your APK file before distributing it to end-users. The Android build tools can handle this for you. Android Studio automatically aligns your APK.
(c) SAP or Antisplit: SAP means single APK package. Some apps use multiple or split APKs bundled to build a single APK to reduce the size of the app. These cannot be
 
Last edited:
Re: Basics Of What a APK Contains

Hey guys I noticed that NGU phone Modding never really went into details on how to mod a app so I figured I'd start it somewhere to help those who want to learn how to Modify Apps for the serversided app are abit more complicated so I'll just stick the the basics at the moment no need to rush tutorials

Basics of what is apk file and things inside it

APK file modding basic tutorial & description.


Description or more detailed explanation by my own


Usually an APK file contains the following files:


1)AndroidManifest.xml

Application manifest file, version number, version name, permissions, application name, application icons, activities, services, broadcasts and other configuration information are in this file.

It's like brain to App

(we can play with this by changing or deleting or adding some stuff to it)

2)classes.dex

Android code file. In the development of Android applications, if the developers write Java codes, the codes will be compiled into many class files, and finally these files are combined into classes.dex file, so most of the java codes of applications are in this file. Some apks with bigger size may contains multiple dex files, such as classes1.dex、classes2.dex…

Essentially, any Activity, Object, or Fragment used within your codebase, will be transformed into bytes within a Dex file that can be run as an Android app.

Confused? Don't worry I'll explain in my upcoming page by videos on it with simple way to understand to you

3)resources.arsc

Resource configuration file contains the string, theme, picture file index, layout file index and other information.

(mostly this file is encrypted if you view through mt manager... Apkeditor converters to res directly


res/

Resource folder contains pictures, layouts, menus and other files. The indexed files in the resources.arsc are stored in the directory (except for resource confusion)

4)assets/

Secondary resource folders (Not every APK has it). The files inside will not be indexed in resources.arsc.

(sometimes lib files,html files, pictures, videos, data like games, html,css, java,media, fonts,ttf files,binary files, etc in it)

5)lib/

The folder contains .so library files. Such files are usually developed by C/C++.

Very important this files are used to run an app in a particular architecture device's... See my video tutorial I'll explain in it detailed

6)META-INF/

It is often not useful, because it is just for storing information about signature.

(certificates of apk is stored in this folder)

This folder is under Unknown tab...

Sometimes i delete signature files but sometimes it is useful so not delete them if they useful..

Now I'm explaining some important terms in modding ...

(a) APK Clone

In the Android system, the package name is the ID of each application. After the application is updated, the name, the picture and the interface may be changed. Only the package name can not be changed. For different applications, their package names should be different. Otherwise they will be considered the same applications.

Through this principle, you only need to change the application package name, so that you can install the same application twice or more in your device.

(b)Zipalign

zipalign is an archive alignment tool that provides important optimization to Android application (APK) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the APK, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application.

This tool should always be used to align your APK file before distributing it to end-users. The Android build tools can handle this for you. Android Studio automatically aligns your APK.


Note:1)You must use zipalign at one of two specific points in the app-building process, depending on which app-signing tool you use...
2)also if u use apksigner to sign then zipalign before you sign

(c)SAP or Antisplit

SAP means single apk package...

Some apps use multiple or split apks bundled to build single apk to reduce the size of the app...

So we cannot mod them until they converted in normal single apk...

This method of converting SAP is called antisplit...

You can do it just follow simple tool I'll provided and I'll explain in detail in my blog...

(d) Decompile & Recompile(compile)

Decompilation is sometimes used unethically, to reproduce source code for reuse or adaptation without permission of the copyright holder. So we need to decompile any apk to make changes to it...

After completion of our mod then converting back to apk is called compile or recompile... While we recompile if we done any mistakes then it won't recompile so we need to rectify them and then recompile succeed...

(e) Sign apk

The meaning of signature
When you modify an apk and do not sign it, you will find that you can not install successfully (unless you modify the system).so we need to sign apk after our modding... Complicated right? Don't worry we help you to teach you in detail by simply in another blog

(f) AAPT & AAPT2

AAPT means Android Asset Packaging Tool
So aapt checks less errors when compile apk and aapt2 checks max all errors of your mod... So it helps to rectify them and triggers you not to crash our mod after build is done...

Cool now you understand some terms... Ok now you can do mod things but some more basic info you need to know how to use tools Like apkeditor, apktool m,
mt manager...

More about Modding Apps will be shared I'll try to keep it simple to follow this can be done on non rooted devices but it's preferable to have a rooted device. I currently have both root & non rooted devices non rooted device is Android 10 or Q

Thanks for contributing to PlayerSquared, boss! You're the reason why I wake up motivated to keep coming on the site. Try tightening your threads up a bit to make it look cleaner, you'll be having crazy looking posts. Keep up the great work, :D
 
Last edited by a moderator: