I am also learning about the APK structure by referring to the materials on other websites. In this article, I will give a brief description. In the next article, I will refer to the detailed examples. The APK file is actually a zip package and can be unzipped. The following figure shows the content after the helloworld.apk file is opened by zipping. The structure is similar to that of the project, as shown in:
Manifest File
Androidmanifest. XML must be defined and contained by each application. It describes the application name, version, permission, referenced library file, and other information. For example, to upload an APK to Google market, configure the XML file.
META-INF directory
The META-INF directory stores signature information to ensure the integrity of the APK package and system security. When eclipse compiles an API package, it will do a verification calculation for all the files to be packaged, and put the calculation result under the META-INF directory. When the APK package is installed on the Android platform, the Application Manager checks the file in the package according to the same algorithm. If the verification result is inconsistent with the content in the META-INF, the system will not install this APK. This ensures that the files in the APK package cannot be replaced at will. For example, after obtaining an APK package, if you want to replace an image, a piece of code, or a piece of copyright information, it is basically impossible to directly decompress, replace, and re-package the package. This increases the difficulty of virus infection and malicious modification, and helps protect the security of the system.
Classes. Dex File
Classes. Dex is a Java bytecode file generated after Java source code compilation. 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, regardless of the file structure or opcode. Currently, common Java decompilers cannot process Dex files.
The android simulator provides dexdump, A decompilation tool for Dex files. First, start the android simulator, and use the ADB push upload simulator to view the DEX file. Then, log on to the simulator using the ADB shell, find the DEX file to be viewed, and execute dexdump XXX. Dex.
Dedexer is another decompilation tool for Dex files that can be found online. Dedexer can read files in Dex format and generate an output similar to assembly language. This output is similar to the output of Jasmin [], but contains the Dalvik bytecode. We will introduce dedexer in details in the next section.
Res directory
The res directory stores resource files.
Resources. ARSC
The compiled binary resource file.
Summary
With these basic understandings, we will start from the specific elasticsearch project and describe the above structure in the next article.