Android App Analytics APK file structure

Source: Internet
Author: User

        in fact, an APK file is a. zip format of the compressed package, we can use the decompression tool to open any APK file, due to code obfuscation and encryption, the normal decompression tool to open the inside of the file or directory will see a variety of garbled characters. A typical APK file contains the following content:? Androidmanifest.xml
The Android app's configuration manifest file, which introduces many of the configuration information for the app to the Android system, allows the system to understand some of the information about the application to a considerable extent. This file must be defined and included in each app, which describes the name, version, permissions, referenced library files, and so on, to upload the apk to Google Market, and to configure the XML. The androidmanifest.xml in the APK is compressed and can be decompile (decompile the entire apk) through the AXMLPrinter2 tool (for that file) or the Apktool tool.

? Meta-inf Directory
The meta-inf directory contains signature information that is used to ensure the integrity of the APK package and the security of the system. Applications that are not signed are not recognized by the system and cannot be installed on the phone. When the APK is packaged, the Android SDK will save complete information about all the files in the APK, so that the app will be checked for integrity during installation, ensuring that the APK files are not tampered with, greatly improving the security and integrity of the app and system. The Meta-inf directory has Cert.rsa, CERT. SF and MANIFEST.MF These files, where the Cert.rsa file records the developer's private key to the APK signature information, MANIFEST.MF file saves all the files in the entire APK SHA-1 for Base64 encoded value, CERT.SF and MANIFEST.MF difference Not much, including all the latter information, and then added the SHA-1 of the MANIFEST.MF file and base64 the encoded value.

. Res directory
the directory where the various resource files are stored. All the files in this directory will eventually be mapped to the R file in the Android project, generating the ID of the corresponding int, which can be called directly using the resource ID when accessing these resource files in the program. The res directory also contains a number of subfolders: Anmi with animated files, drawable storage of image resources, layout files in layouts, menu items for custom menus, and files in the raw directory that can be copied directly to the device. will not be compiled; values are stored in a special value--colors.xml record your custom color, dimens.xml record your custom size, Strings.xml is your custom string constant value, Styles.xml defines some styles.
? lib directory
This directory contains the application-dependent native library files, the files ending with. So are written in C or C + +, a simple Android application may not need these libraries, but a full-featured and performance-seeking application is impossible to ignore this directory, pedagogical gardening-chip processing, Network processing, audio and video processing, and other high performance requirements of the function, simply rely on Java will be very laborious, more powerful and closer to the bottom of the C + + is a more appropriate choice. according to the CPU of the mobile phone architecture, Lib library can be divided into 4 kinds: ARM, ARM-V7, MIPS and X86, respectively, corresponding to 4 kinds of CPU architecture, in the Lib directory is Armeabi, ARMEABI-V7A, MIPS and x86 a total of 4 directories. The names of the. So libraries in each directory are the same, in fact they are the same, and they are only available to fit the CPU of the different architectures. In fact, almost all mobile phones in the market are ARM architecture, so in most cases we only need to have Armeabi and armeabi-v7a two types of libraries is enough.
? Assets Directory
It's a bit similar to the Res directory, but there's actually a difference between the two. The files in the Res directory are mapped to the R file, each resource file has its own ID, and the file in assets is accessed directly by accessing the file's address using the Assetmanager class, and the assets directory allows you to add subdirectories of any depth. This makes it easier to manage and categorize files. In contrast, the Res directory does not currently support a deeper level of subdirectories.
? classes.dex file
Classes.dex is a Java bytecode file generated after the Java source code is compiled (first, the Java file is compiled into a bytecode file via the JDK and then compiled by Dex into Classes.dex). However, because the Dalvik virtual machine used by Android is incompatible with the standard Java Virtual machine, the Dex file is different from the class file, whether it is a file structure or opcode. None of the common Java Anti-compilation tools currently work with Dex files. The Android emulator provides an anti-compilation tool for the Dex file, Dexdump. Use to start the Android emulator first, put the Dex file you want to view in an emulator uploaded by ADB push, and then log in with the ADB shell to find the Dex file to view and execute Dexdump xxx.dex.     Compare common Java programs and Android program differences:
generic Java program Java Virtual machine Java bytecode (class) based on Stack
Android program Davlik virtual machine Dalvik byte code (DEX) based register

? RESOURCES.ARSC
The index of the compiled binary resource file,a mapping of resource files (that is, files in the Res directory) and resource file IDs is recorded, so that the program can get the appropriate resources based on the ID of the resource when it runs.



From for notes (Wiz)

Android App Analytics APK file structure

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.