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

Why are most organisms "symmetrical"?

Today, the biodiversity of the earth is very rich...

Are there auroras on the sun?

Hello everyone, my name is Zhou Xuzhi, from the I...

360 Search Ads Promotion Keyword Adding and Setting Guide!

What are keywords? Keywords are words or short ph...

Shen Xu | You who protects the young

Bullying in schools is not just a children's ...

Capital pours into licensees; Internet TV competition enters 3.0 era

May 12th is the listing date for the 287 million ...

Featured recommendation: Detailed explanation of the use of xUtils framework

Introduction to xUtils xUtils was originally deri...

How does keep promote itself? What are the points worth learning from?

Keep has currently gone through 5 rounds of finan...

"Short-term Hot Money Training Course" teaches you how to trade stocks

Course Contents: 01: How to find high-performance...