Does Android studio compress the classes.dex file?

It seems that the classes.dex of the APK file in the output folder is different from the installed application

I am using the classes.dex file to solve some security problems, so usually I extract the final APK file and get information from the classes.dex file. However, when I read the classes.dex file at runtime, the file size is so different. (8MB vs 46KB)

The application itself works well. Some people say that Proguard makes the classes.dex file lighter, but I closed Proguard. (use Proguard false, minifyenabled false in build.gradle)

Is there anything I can try? Thank you first

One sentence summary: the classes.dex of the app / build / outputs / APK / app.apk file built by Android studio is different from the classes.dex I can find from the actual application installation location of Android devices

resolvent:

In fact, Android studio converts and uses the term "compress" by default when building

The compilation process of Android applications is very different from other Java applications. But it starts in the same way: use javac command to compile your Java source code file into. Class file:

The. Class file contains the standard Oracle JVM Java bytecode. However, Android devices do not use this bytecode format. On the contrary, Android has its own unique bytecode format, called Dalvik. Dalvik bytecode, such as Oracle JVM bytecode, is the machine code instruction of the theoretical processor

The compilation process needs to convert the. Class file and any. Jar library into a single classes.dex file containing Dalvik bytecode. This is done through the DX command: This is how your classes.dex file is generated

Then compress the classes.dex file and resources in the application (such as images and layouts) into ZIP like files called Android package or. APK files. This is done through Android asset packaging tool or AAPT:

During the build process, your Proguard rules help

>Shrink – detect and delete unused classes, fields, methods and attributes. > optimize – analyze and optimize bytecode of methods. > obfuscate – rename remaining classes, fields and methods with short meaningless names

I hope it helps you to some extent. If you want to know more about how Android applications are built and run, read this. Resources: https://github.com/dogriffiths/HeadFirstAndroid/wiki/How-Android-Apps-are-Built-and-Run

.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>