Preface
Why do I need apk anti-compilation?
is because we in the normal development of the APK process, may encounter some functions do not know how to implement, but some software has implemented the function, but there is no open source. At this point, with the APK's anti-compilation, we can look at the code level to see how others have implemented this part of the function.
Tools
As the saying goes, "工欲善其事, its prerequisite", so to decompile the APK, we need the following two powerful tools (PS: Both tools can cross the platform):
- Dex2jar
- Jd-gui
for anti-compilation
Next, we will use the above two tools to do the anti-compilation apk.
Unzip apk
First, we need to unzip the APK using unzip. The specific commands are as follows:
-d /tmp/test
Dex2jar
Next, use this artifact to convert the Classes.dex file in the apk to a jar file. The specific commands are as follows:
bash -x d2j-dex2jar.sh classes.dex
Note that you need to execute permissions for d2j-dex2jar.sh and d2j_invoke.sh two scripts.
Jd-gui
Like my Ubuntu 13.10 64-bit version when using Jd-gui, you may encounter the following error:
while loading shared libraries:...
The main is the lack of 32-bit libraries, the following installation commands can solve these problems:
sudo apt-get install libgtk2.0-0:i386 libxxf86vm1:i386 libsm6:i386 lib32stdc++6
Then, directly with Jd-gui open just dex2jar.sh generated Classes-dex2jar.jar can see the source of the anti-compilation. Such as:
However, as shown, most of the current market-released APK will be confusing code.
Android APK Anti-compilation