Anti-compilation in MAC environment apk

Source: Internet
Author: User

0, Tool Summary

Our anti-compilation apk mainly uses the following three tools

    • Apktool: Used to get resource files
    • Dex2jar: Get the source file jar package
    • Jd-gui: Anti-compilation source file jar package View source code
Looking for these tools to toss me a little time, now I find the final version of the available to put Baidu Cloud. Download the link below: Http://pan.baidu.com/s/1qWDmf2O

1,apktool Getting resource files
Apktool actually more than one file, which contains aapt,apktool,apktool.jar three files,



Finally, the command line we call is Apktool, and the other two files are the tools they depend on. Copy these three files to the directory/usr/local/bin, then you can use the Apktool directly with the command line, you can detect the detection effect


Then you can start to decompile your apk to get the resource file, first use the command line to switch to your APK directory, and then execute the command
Apktool D xxxx.apk
At the beginning of the execution of the above command, I encountered a problem like this, someone on the internet has met


Finally found the problem is that the Apktool three files in the Apktool.jar version is too low, and finally I downloaded the latest version of the replacement, so the problem solved, the final effect is as follows


Once the above command is executed properly, you will find that the current directory generates a folder with the same name as the APK, which contains the resource files generated by the decompile. Apktool use ends here.
2,dex2jar getting the source file jar package
First change your apk file to zip file format, then extract it, there will be a Classes.dex file, and then we get the source file from this file. Copy the Classes.dex file to your Dex2jar folder and call d2j-dex2jar.sh to decompile, you can encounter the following problems


It is common to encounter this problem on Mac, which can be solved with the following command
sudo chmod 777 d2j-jar2dex.sh
D2j-jar2dex.sh may also depend on other. sh files in the same directory, you may need to perform the above command for other. sh Files (I encountered thed2j_ivoke.sh also needs to execute the following command)。
Once the problem is fixed, you can actually start to decompile and get the original file, using the following command
./d2j-dex2jar.sh Classes.dex

As follows


After executing the command, the current directory generates a Classes-dex2jar.jar file, which is the jar package of the resulting source file, and we will be the last step to get the jar package back to the Java file
3,jd-gui getting Java source files is easy, you just need to open the Classes-dex2jar.jar generated in the previous step in Jd-gui. Generally we can get all the resource files, slices, layout files, but the source files are confused.

Above!



Anti-compilation in MAC environment apk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.