Android Basics Getting Started tutorial--1.10 anti-compilation APK get Code & Resources

Source: Internet
Author: User

Android Basics Getting Started tutorial--1.10 anti-compilation APK get Code & Resources

tags (space delimited): Android Basics Getting Started Tutorial

Introduction to this section:

"Anti-compilation apk", it seems like a very high-end appearance, is not, is through some anti-compilation software, the anti-compilation of our apk, so as to obtain the program's source code, images, XML resources and other files; I don't know if you've ever done that, see an app interface that someone else has done beautifully, Or you fancy someone else's picture material, simple point, we can download other people's apk, then change the suffix name, change to Xxx.zip, and then extract:
The author randomly extracted an apk:

We can open the Res directory and get the picture material inside.

However, this approach, Only a few. png, or. jpg bitmap file resources, if it is the resources of the XML class, open we will find is garbled, and if we want to see the APK program Java code, it is not feasible, because they are packaged into the Classes.dex file!
But anti-compilation can solve your needs ~ In addition, do not take anti-compilation to do illegal things, such as the people's apk repackaged after the use of their own signature and then posted to the relevant market ... In addition, we are referring to someone else's code, not a full copy!!! Remember!!

1. Three tools to prepare
  1. apktool: Get resource files, extract picture files, layout files, and some XML resource files
  2. Dex2jar: decompile apk to Java source (convert Classes.dex to jar file)
  3. Jd-gui: View the converted jar file in 2, that is, view the Java file
    For the convenience of your readers, here are three packaged together in a cloud disk, and you need to download:
    Anti-compilation related three tools. zip
2. Use Apktool decompile apk to get pictures and XML resources:

After extracting the downloaded Apktool, we can see the following files (ignore the two csdn, one is the anti-compilation apk, one is the post-compilation file):


Next, double-click Cmd.exe, go to the command line, and type:
Apktool.bat D csdn.apk , enter enter:

Then you can see the generated Csdn folder, and there's a resource we want to

Okay, that's the XML resource. The picture material is also hand in hand!

3. Convert the Classes.dex to a jar file using Dex2jar:

Unzip the downloaded Dex2jar folder, and the Classes.dex in the APK decompression is copied to the directory where the Dex2jar.bat is located:

Open cmd and come to this directory: type:d2j-dex2jar.bat classes.dex

Then we can see that a jar package was generated:


OK, the conversion is complete!

4. Use Jd-gui to view the Java code in the jar package:

Okay, open the Jd-gui folder.

After opening, open our 3 converted jar Package, we can see the code inside:


CSDN's client is not confusing the code ... May be in the spirit of open source, to learn the code for us! In general, the APK release will
To confuse, and then do some encryption, or use a third-party encryption platform, with more "love Encryption", interested in Baidu also self-view more detailed introduction!

This section summarizes:

OK, the anti-compilation of the APK is introduced here, I believe you have been ready to try it out, then try it, the last reminder, don't do bad things! Respect the fruits of others ' work! In addition, about the first chapter of environmental construction and some common development skills here, in the next section, we will go to the second chapter of this series of tutorials--android common UI controls in the learning! Because of the relevant basic control more, an estimated dozens of, if you have been learning the control may not be interesting, may be in parallel to write tutorials, a daily learning a control + a little other knowledge points so, I want to conceive of ideas, please look forward to ~ Thank you ~

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

Android Basics Getting Started tutorial--1.10 anti-compilation APK get Code & Resources

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.