How to translate Android decompilation into readable source code

Source: Internet
Author: User

 

Reading the source code is the best way to learn. Let's take Angry Birds as an example to see how to decompile an android game into a readable source code.

(China Software Network News) Reading source code is the best way to learn. Let's take Angry Birds as an example to see how to decompile an android game into readable source code.

Tool introduction:

1. apktool is used to extract XML files.

Download the first two files to the http://code.google.com/p/android-apktool/downloads/list and decompress them to the platform tools directory of the android SDK.

Usage in the command line:

Apktool D decompress your apk.apk to the specified folder, for example:

Apktool d F: \ learn \ Android \ decompile \ Angry Birds .apk F: \ learn \ Android \ decompile \ Angry Birds

 

<? XML version = "1.0" encoding = "UTF-8"?>
<Manifest Android: versioncode = "1620" Android: versionname = "1.6.2" Android: installlocation = "Auto" package = "com. Rovio. angrybirds"
Xmlns: Android = "http://schemas.android.com/apk/res/android">
<Application Android: Label = "@ string/app_name" Android: icon = "@ drawable/icon" Android: debuggable = "false">
<Activity Android: theme = "@ Android: style/theme. notitlebar. fullscreen "Android: Label =" @ string/app_name "Android: Name =" com. rovio. ka3d. APP "Android: launchmode =" singletask "Android: screenorientation =" Landscape "Android: configchanges =" keyboardhidden | orientation ">
<Intent-filter>
<Action Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter>
</Activity>
<Activity Android: theme = "@ Android: style/theme. notitlebar. fullscreen "Android: Name =" com. burstly. lib. component. networkcomponent. burstly. videoplayeractivity "Android: configchanges =" keyboard | keyboardhidden | orientation "/>
<Activity Android: theme = "@ Android: style/theme. notitlebar. fullscreen "Android: Name =" com. burstly. lib. component. networkcomponent. burstly. burstlyfullscreenactivity "Android: configchanges =" keyboard | keyboardhidden | orientation "/>
<Activity Android: Name = "com. Google. Ads. adactivity" Android: configchanges = "keyboard | keyboardhidden | orientation"/>
<Provider Android: Name = "com. greystripe. android. SDK. adcontentprovider "Android: exported =" false "Android: Multiprocess =" true "Android: Authorities =" com. rovio. ka3d. adcontentprovider "/>
<Activity Android: Name = "com. greystripe. Android. SDK. adview" Android: configchanges = "keyboard | keyboardhidden | orientation">
<Intent-filter>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter>
</Activity>
<Activity Android: Name = "com. millennialmedia. Android. mmadviewoverlayactivity"/>
<Activity Android: theme = "@ Android: style/theme. notitlebar. fullscreen "Android: Name =" com. millennialmedia. android. videoplayer "Android: configchanges =" keyboard | keyboardhidden | orientation "/>
<Supports-screens Android: anydensity = "true" Android: smallscreens = "true" Android: normalscreens = "true" Android: largescreens = "true"/>
<Activity Android: theme = "@ Android: style/theme. notitlebar. fullscreen "Android: Name =" com. burstly. lib. component. networkcomponent. jumptap. jumptapactivity "Android: configchanges =" keyboard | keyboardhidden | orientation "/>
</Application>
<Uses-Permission Android: Name = "android. Permission. Internet"/>
<Uses-Permission Android: Name = "android. Permission. read_phone_state"/>
<Uses-Permission Android: Name = "android. Permission. access_network_state"/>
<Uses-Permission Android: Name = "android. Permission. write_external_storage"/>
<Uses-Permission Android: Name = "android. Permission. access_wifi_state"/>
<Uses-Permission Android: Name = "android. Permission. access_coarse_location"/>
<Uses-SDK Android: minsdkversion = "4" Android: targetsdkversion = "8"/>
</Manifest>

 

This is our androidmanifest file after pressurization. We can see that the angry birds have a total of 8 activities.

 

 

2. dex2jar: decompile the DEX file into a jar file.

Download this tool from http://code.google.com/p/dex2jar/downloads/listand folder all files and files to the platform tools directory of the android SDK.

Usage:

Dex2jar F: \ learn \ Android \ decompile \ Classes. Dex decompile the DEX file into a jar file. By default, a classes_dex2jar.jar file is generated in this directory.

 

3. xjad is used to decompile jar files into java files.

This is a visual tool for decompiling jar files into java files. Directly decompiling jar files will automatically generate a folder containing java files.

 

Download Angry Birds source code:

Http://dl.dbank.com/c0olagap0k

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.