Android basic getting started tutorial -- 1.10 decompile APK to get code & amp; resources, androidapk

Source: Internet
Author: User

Android basic getting started tutorial -- 1.10 decompile APK to get code & Resources, androidapk
Android basic getting started tutorial -- 1.10 decompile APK to get code & Resources

Tags (separated by spaces): basic Android tutorial

This section introduces:

I decompress an APK at will:

We can open the res directory to obtain the image material in it.

However, this scheme only involves some bitmap file resources such as .png and .jpg. If it is an xml-type resource, we will find it garbled and it will not work if we want to see the Java code of the APK program, because they are all packaged into classes. dex file!
However, decompilation can solve your needs ~ In addition, do not use decompilation for illegal tasks. For example, repackage your APK and use your own signature to publish it to the relevant market... In addition, we refer to other people's code, rather than completely copying !!! Remember !!

1. Three tools to be prepared
2. decompile the APK using apktool to obtain image and XML resources:

After decompressing the downloaded apktool, we can see the following files (ignore the two csdn, one is the decompiled apk, and the other is the decompiled file ):

Next, double-click cmd.exe to go to the command line and type:
Apktool. bat d csdn.apkRight, Enter and press Enter:

Then we can see the generated csdn folder, which contains the resources we want.

Okay, the XML resource is ready, right! The image material is ready!

3. Use dex2jar to convert classes. dex to a jar file:

Decompress the downloaded dex2jar folder, and copy classes. dex in the apk to the directory where dex2jar. bat is located:

Open cmd and enter the following directory: Type:D2j-dex2jar.bat classes. dex.

Then we can see that a jar package is generated:

Okay. 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 the converted jar package in 3, and we can see the code in it:

The csdn client does not confuse the code... It may be in the spirit of open source. Let's learn the code! In general, the apk will be released
Obfuscation, encryption, or third-party encryption platforms, and more "Love encryption" are used. If you are interested, please refer to Baidu for more details!


Okay. Here we will introduce the decompilation of APK. I believe you are ready to try it. Let's try it. Finally, Let's remind you not to do anything bad! Respect others' labor achievements! In addition, this is the first chapter about environment setup and some common development skills, at the beginning of the next section, let's take a look at the second chapter of this series of tutorials-common UI controls in Android! Because there are many related basic controls, it is estimated that there are dozens of controls. If you have been learning controls, it may be boring to write tutorials in parallel. Every day, you can learn one control + a few other knowledge points, I want to design the concept, so stay tuned ~ Thank you ~

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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: 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.