Android Anti-compilation

Source: Internet
Author: User

Sometimes you need to decompile other people's apk, to see how others are realized, but also to get a lot of material, do not go to the pictures themselves, the following share the recent self-compilation of the learning record.

1. Download the anti-compilation tool Apktool

Https://bitbucket.org/iBotPeaches/apktool/downloads

About Apktool tools, you can take a look at the introduction of Apktool official website

Apktool download Down is a jar package: Apktool_2.0.1.jar
Java-jar Apktool_2.0.1.jar D <file.apk> <dir>
Java-jar Apktool_2.0.1.jar d-f <file.apk> <dir>//If the dir directory already exists, it will be forcibly overwritten

Eg:java-jar Apktool_2.0.1.jar D app-debug.apk  //To decompile apk to the current directory
After the successful decompression can see the apk in the mainfest, layout, pictures and other documents.
Of course, if you have a certain understanding of the Smali file, you can modify the Smali file to achieve the purpose of changing the original program behavior, and then re-packaging with Apktool to build the apk file
Java-jar Apktool_2.0.1.jar b <file>//The argument behind it is the file name generated above file.apk decompile

Eg:java-jar Apktool_2.0.1.jar b app-debug
2. If you want to see the Java code of the APK, you need to decompile the class file into a. java file

Download the Dex2jar tool, the introduction of the tool can view Dex2jar's introduction

Use the downloaded dex2jar-2.0 tool to get the apk class.dex file into Classes_dex2jar.jar file, where the Class.dex file can be extracted directly from the apk file, the suffix apk to zip directly unzip the line
Just open the Class.dex with D2j-dex2jar.bat in Windows and use the following command on Linux

If you encounter the following error, you need to modify the permissions of these two files
./d2j-dex2jar.sh:36:./d2j-dex2jar.sh:./d2j_invoke.sh:permission denied
chmod 777 d2j_invoke.sh d2j-dex2jar.sh

After you convert the Class.dex file in the apk to Classes-dex2jar.jar, you can use the Jd-gui file to view it, Jd-gui

http://jd.benow.ca/

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Anti-compilation

Related Article

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.