First, decompile the APK file
Install the Apktool tool, which decodes the resource file, but does not get the Java source file.
Installation environment: Need to install JRE1.6
1> to http://code.google.com/p/android-apktool/
Download apktool1.3.2.tar.bz2 and apktool-install-windows-2.2_r01-3.tar.bz2 files.
Extract two files, and then put the extracted files together, such as: C:\apktool
2> adds a aapt.exe to the system variable path, such as:; C:\apktool\aapt.exe
3> enters the Apktool.jar directory under the DOS window.
Execute DOS command: Apktool D-c:\soft\xxx.apk C:\soft\source.
Command format: D in Apktool D [opts] <file.apk> [dir] represents the decoding, [opts] represents the option, and the-s option represents not decoding the source file.
2, Apktool tool can only decompile into Smali intermediate code file, here need to use another open source tool Dex2jar,
The tool can convert a Dex file into a jar file. This tool cannot be translated directly into a Java file, but can convert a Dex file into a jar file
Download Address: http://code.google.com/p/dex2jar/
1> extract the Classes.dex from the APK installation package into a directory, such as: C:\soft
2> into the Dex2jar.bat directory under the DOS window, executing DOS commands: Dex2jar.bat c:\soft\source\classes.dex C:\soft\source, command to generate the Classes.dex.dex2jar.jar file.
3, install the Jd-gui tool, the tool can compile the jar file back to Java source file
Download Address: Http://java.decompiler.free.fr/jd-gui/downloads/jd-gui-0.3.3.windows.zip.
Run the software, open the Classes.dex.dex2jar.jar file directly to see the Java source code.
Summarize:
APKTOOL1.4.1.TAR.BZ2 the jar package for the reverse compilation tool
apktool-install-windows-r04-brut1.tar.bz2 windows down to execute jar EXE file
1, decompression These two files, will apktool1.4.1 in the Apktool.jar copy to apktool-install-windows-r04-brut1 directory, at this time the file has:
Red for apk files to be decompile
CMD switches to the directory and executes:
> Apktool d querynumber.apk./source generates the source directory in the current directory, with resource files below
2, decompression dex2jar-0.0.7.11-snapshot.zip will classes.dex copy the directory, execute:
> Dex2jar Class.dex
Generating Classes_dex2jar.jar files
It's all. class files Inside
3, open Jd-gui.exe, drag Classes_dex2jar.jar to the Jd-gui interface
You can see all the source files at this time:
How to prevent decompile ....
Because the APK is loaded by the Android virtual machine, it has a certain specification, APK Dalvik cannot recognize apk after encryption.
It's impossible to avoid it completely, and someone will always be able to hack your code. But there are several ways to improve the difficulty of being decompile a substitution code.
1 critical code uses JNI to invoke local code, written in C or C + +, so it is relatively difficult to decompile
2 confusing Java code. Confusion is not to change the code logic, add useless code, or rename, so that the reverse-compiled source code difficult to read.
Online open-source Java code obfuscation tools are more commonly used in ant way to compile the
The above mentioned is the entire content of this article, I hope you can enjoy.