Android decompile xml files

Source: Internet
Author: User

I. Preface:

Hello everyone, today I will share with you about the latencies in Android. We often encounter an application (apk) that we think is very beautiful and handsome, so we will try to use tools such as WinRAR to view it, the general application package directory is usually like this:

 

Of course, images in res can be used as needed (many of my application images are deducted from others' apk ), such as layout and permission files (AndroidManifest. xml) is already a bunch of garbled characters, and it is not easy to understand. The source code has been compiled into classes. dex, which does not show any clue. Based on the above confusions, I would like to share with you the latencies in Android.

2. required tools (click their respective links to enter the download page ):

1. AXMLPrinter2.jar

2. baksmali. jar

3. smali. jar

Iii. Preparations

For convenience, the authors put AXMLPrinter2.jar, baksmali. jar, and smali. jar (to facilitate renaming) in the Android SDK tools Folder, as shown in:

 

To make it easier for you to compare programs, the author writes a simple application (called APKInstaller) directory structure, as shown in:

 

4. Start to take things

1. Use AXMLPrinter2.jar to view the layout xml file in the apk:

Open apkinstaller.apk generated by apkinstaller.apk (put it in the tools directory for convenience) with tools such as WinRAR and decompress res/layout/main. xml (also put it in the tools directory)

Open the main. xml file with the following content (a pile of astronomy ):

 

At this time, AXMLPrinter2.jar came in handy. Open the cmd terminal and go to the tools directory. Enter the following command:

Java-jar AXMLPrinter2.jar main. xml> main.txt. (as shown in)

 

Open the main.txt Code as follows (Is There A 123 error ~) :

View plaincopy to clipboardprint?
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout
Xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "1"
Android: layout_width = "-1"
Android: layout_height = "-1"
>
<WebView
Android: id = "@ 7F050000"
Android: layout_width = "-1"
Android: layout_height = "-2"
>
</WebView>
</LinearLayout>
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout
Xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "1"
Android: layout_width = "-1"
Android: layout_height = "-1"
>
<WebView
Android: id = "@ 7F050000"
Android: layout_width = "-1"
Android: layout_height = "-2"
>
</WebView>
</LinearLayout>
 

To compare the main. xml code in the open source program as follows (check the code ):

View plaincopy to clipboardprint?
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
>
<WebView
Android: id = "@ + id/apk_web"
Android: layout_height = "wrap_content"
Android: layout_width = "fill_parent"

/>
</LinearLayout>

 

This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/Android_Tutor/archive/2010/07/06/5716970.aspx

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.