Decompiled code

Tools used:

  • Dex2jar — Convert dex files into JAR files
  • Jd_gui – Convert JAR files into Java code

Specific operation

dex2jar

  1. Rename the APK file you want to decompile to a ZIP file and unzip to get the associated folder.
  2. To prevent the dex file from being decompressed to the dex2jar directory, go to the directory and run commands
d2j-dex2jar class.dex
Copy the code

If there are no errors, there is an additional JAR file in the dex2jar directory, which is the jar file successfully converted by the tool.

Jd-gui tool to use

Open the JAR file generated with Dex2jar to view the corresponding Java code.

Decompile resources

By decompressing the way to obtain the resource file is compiled in the packaging process, direct open is not to see the plaintext code, so we want to decompile the resource file, then we need another tool — apktool, more tools can restore the apK resource file to a great extent.

Specific operation

  1. Download two files, apktool.jar and apktool.bat, and place them in the same folder.
  2. Copy the decompiled APK file to this folder
  3. Access the file directory on the terminal and run the following command:
apktool d xxx.apk
Copy the code

Apktool Indicates the meaning of additional parameters

  • -f Deletes the existing folder forcibly if the target folder already exists. By default, the decoding fails if the target folder already exists.
  • -o specifies the name of the target folder to decode (by default, the target folder is named after the APK file).
  • -s does not decompile dex files, meaning that classes.dex files are kept (dex files are decoded into smali files by default).
  • -r does not decomcompile resource files, that is, resources.arsc files are retained (by default, resources.arsc is decoded into a specific resource file)

After the preceding operations are complete, you can view APK resource files normally. If the operation fails, enter the search result based on the error information.