Android decompilation: decompilation tools and methods

Android decompilation: decompilation tools and methods

[[126320]]

Preface

Sometimes during the development process, you will encounter some functions that you don't know how to do, but other software already has them. At this time, you can use decompilation to unlock other programs to understand their practices. At the same time, you can also learn from other people's software structures, resource files, etc., haha. Then I will explain some knowledge related to decompilation, which is mainly divided into three parts. The first part introduces the tools and methods of decompilation, the second part introduces the syntax of smali, and the third part introduces how to prevent decompilation. Through these articles, you can understand how to do decompilation and code reinforcement.

tool

apktools-the most powerful decompilation tool

Easily decompile apk, parse out resource files, xml files, generate smali files, and you can also generate apk from the modified files you want.

Support windows, linux, and mac.

Download address: https://code.google.com/p/android-apktool/downloads/list Please bring your own ladder

dex2jar

Convert the dex file in the apk into a jar file. Many people do not know how to read smali files, and are more comfortable reading java class files. In this case, you can use this tool to convert it into java, which also supports windows, linux, and mac.

Download address: http://code.google.com/p/dex2jar/downloads/list

jd-gui

View the jar file, and you can basically see the java class file. It also supports mac, windows, and linux.

Download address: http://jd.benow.ca/

Apktool's command line comprehensive tool recommends apktool plus

It is actually a tool written by someone else, which combines the functions of apktool and also supports signing apk. The latest version is v9update6, which only supports Windows system.

Download address: http://dl.dbank.com/c0jndlkbu4#

Decompile

Using apktools

Execute the following command in the apktools directory

  1. ./apktool d pathtoapk outdir #mac linux
  2. apktool.bat d pathtoapk outdir #window

In this way, the decompilation can be successful, and the resource files and smali files can be viewed. Of course, some apps have been specially processed and not all of them can be decompiled.

At the same time, apktool can also reverse the decompiled file into an apk file, the format is as follows.

  1. ./apktool b apppath outpath

If the reversed file is unsigned, it needs to be signed before it can be installed.

Using dex2jar

The apk file itself is actually a zip compressed package. First, change the apk into a .zip file and decompress it to get a classes.dex. Go to the dex2jar directory and execute the following command.

  1. ./d2j-dex2jar.sh pathtoclasses.dex #mac linux
  2. d2j-dex2jar.bat pathtoclasses.dex #wind

A jar file will be generated afterwards. You can open it with jd-gui to see the java code in it.

other

In fact, the decompilation we use is enough. Usually, we cannot obtain a lot of code. After all, people also have measures to deal with it.

Original URL: http://blog.isming.me/2015/01/11/android-decompile-tools/

<<:  2015 Spring Festival Homecoming High-end App Recommendation

>>:  iOS source code download: stacked cells in groups

Recommend

20 brands tell you the triple realm of brand content marketing in 2016!

Today's society has entered a stage of consum...

Acg sentence control

Source code introduction Keep your favorite peopl...

618 Marketing Promotion Plan Creation Guide, 1 Step to Get It Done

Every marketing plan with soul must not be a pile...

Is the information flow product-centric or user-centric?

In life, the things we come into contact with the...

Cadillac sales in China surpass those in the U.S. for the first time

Just after this year's Spring Festival holida...

How to build a personal brand?

This article will give you a clear answer once an...