Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Source Code Reading in APK decompilation

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

APK decompilation how to achieve source code reading, I believe many inexperienced people are helpless, for this reason this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

1 What is decompilation?

We write source code compiled into executable files, decompilation is the reverse process.

Why do I need to study decompilation?

In small company development, occasionally only 1-2 people work independently on a project. After encountering problems, you may not have any technology around you. At this time, decompilation can be used to study the source code of a program with similar functions, learn from other people's programming ideas and experience, and improve your own programming ability.

This special statement tells you that this method is purely for learning programming skills, not teaching you to pirate other people's software.

2 decompilation three-piece set

We need to decompile the three tools apktool, dex2jar, jd-gui, as shown in the following figure

apktool tool: Get the resource files (images and layout files) we need to decompile APK files.

dex2jar tool: decompiles APK into source code.

jd-gui tool: View source code files in APK.

3 How to decompile APK and view source code

First put the apk to be decompiled in the apktool folder, open it with the command line, and enter the following command: apktool d xxx.apk

After decompilation is completed, a new folder will appear in apktool, the same name as apk folder, this folder, we need layout files and image resource files. The specific folder is shown in the following figure:

2. Next we introduce the use of our second tool dex2jar. First we need to change the suffix name of the APK to.zip, and then extract it. The directory structure of the extracted folder is as follows:

At this point we will see that the unzipped file will have a classes.dex file, and then put this file in the dex2 jar folder directory, the same level directory as dex2jar.bat. Then navigate to this layer directory and type dex2jar.bat classes.dex

After seeing the above image, we will see that a file classes_dex2jar.jar will be generated under the directory, as shown in the following figure:

3. Finally, we introduce the use of our third tool, jd-gui. This is very simple, just a code viewer. Open the jd-gui tool and drag in the classes_dex2jar.jar file generated in the previous step. It's that simple. We will see the apk source code as shown below. If you have contact with Google source code, you will know that the apk code I decompiled this time is Google's native browser source code.

After reading the above, do you know how to decompile APK to read the source code? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report