Android program files are in APK format. APK files are the final executable programs for Android, and APK stands for Android Package. They are similar to sis files in the Symbian operating system and JAR files on the J2ME platform. Actually, APK files are in ZIP file format, but the extension is changed to APK. After unzipping with RAR, you can see Dex files. Dex stands for Dalvik VM executes, which means the Android Dalvik executable, and it is not Java bytecode but Dalvik bytecode.
The structure of an APK file is as follows:
- res/ — Directory storing resource files
- META-INF/ — Commonly seen in Jar files
- resources.arsc — Compiled binary resource file, mainly used for strings in the program
- AndroidManifest.xml — Program global configuration file
- classes.dex — Dalvik bytecode file; our JAVA files are compiled into DEX bytecode format
In summary, we find that when Android runs a program, it first needs to unzip. Similar to Symbian, it is different from the PE files in Windows Mobile. This approach is not very high in terms of program confidentiality and reliability. Dex files can be decompiled using the dexdump command, but this approach aligns with development trends. Microsoft's Windows Gadgets or WPF also use this kind of structure.
1. Java files — Application source files
I think these are the files everyone thinks of when hearing about Android. A significant portion of Android itself is written in Java (basically, the blue parts in the architecture diagram are developed with Java). Android applications must be developed using Java.
2. Class files — Target files compiled from Java
Unlike the usual J2SE, where Java compiled into class files can run directly, on the Android platform, class files cannot run directly on Android. Since Google uses its own Dalvik to run applications, these class files cannot run in the Sun Java environment either. I personally feel that Android class files are actually just intermediate target files in the compilation process. They need to be linked into Dex files before they can run on Dalvik.3. Dex Files —— Executable Files on the Android Platform
Dex files are the bytecode file format supported by the Android virtual machine Dalvik. Google defined its own Dalvik virtual machine on the newly released Android platform, which executes not Java bytecode, but another type of bytecode: dex format bytecode. After compiling Java code, tools on the Android platform can convert Java bytecode into Dex bytecode. Although Google claims that Dalvik is customized for mobile devices, many in the industry believe it is to avoid applying for a Java license from Sun. Since not much detail has been disclosed, the specific implementation of Dalvik is still not available, and only simple analysis can be done based on the SDK.
This Dalvik VM has been optimized for mobile programs/CPUs and can run many VMs simultaneously without taking up too many resources. The Dalvik VM source is not yet available for download (the entire system will be open in the future). Currently, Google's perspective is to allow everyone to start developing apps using this SDK, with the lower-level components to be released gradually.
4. Apk Files —— Installation Files on Android
Apk is the extension for Android installation packages. An Android installation package includes all files related to a specific Android application. The apk file packages the AndroidManifest.xml file, application code (.dex file), resource files, and other files into a compressed archive. Only one .apk file can be generated for a project.
As for how to crack it, that depends on the individual.