Preface


In daily development, we may need to decompile apps to inspect or analyze certain issues. For example:

  1. Extracting resource files from an app, such as music, videos, web pages, images, etc.
  2. When trying to achieve a similar effect in an app, you can decompile it to view key code, such as reverse camera imagery, screen casting, etc.
  3. Modifying an app to replace its icon, adjust the layout of app pages, add multi-language support, etc.

Note: The following code can be run on both Mac and Windows systems.

Preparation


ApkTool

You can download it from **https://github.com/iBotPeaches/Apktool.** If you are using Mac, you can install it with Homebrew by executing the command brew install apktool.

If you only need to view the app's resources, Apktool should be sufficient for your needs. If you need to view the app's source code, you will also need to use dex2jar and jd-gui. There are tutorials available online that you can search for to guide you through the process.

Dex2jar

Convert .dex files to .jar files.

You can download it from https://sourceforge.net/projects/dex2jar/files/

Jd-gui

It allows you to explore the Java source code contained within the JAR file.

You can download it from http://java-decompiler.github.io/

Android SDK