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

Are your teeth sensitive after teeth cleaning? A periodontist will tell you →

As a periodontal specialist, I often encounter pa...

How to solve the problem of Google ads not ranking?

When doing Google advertising today, you will enc...

Is staying up late really that unhealthy? Actually...

Hello, this is Science Popularization China. Toda...

9 strategies for optimizing information flow ads!

Account optimization refers to the process of con...

It's raining "microplastics" from the sky...|Environmental Trumpet

Hello everyone, this is the 2nd issue of the Envi...

Lao Duan said: How far is Huawei from television?

In the second half of last year, Huawei Honor'...

Ocean energy research: understanding the ocean's climate code

As a major driving force of the global economy, t...

Douyin marketing plan and advertising number selection strategy

In the past three years, I have managed the entir...

The Japanese have acquired ARM, so Apple can switch to MIPS

The biggest news in the technology circle these d...