Android documentation decompile

2010-12-13  来源:本站原创  分类:Mobile  人气:251 

Android documentation decompile

Made by Li Wendong [email protected]

2010-12-13 Monday in Beijing

A, decompile flowchart

Android documentation decompile

Second, tools to use (command)

Preparations

Suppose I am working directory for the $ AndroidDecompile, first of all to system.img in (or compiled from source code) of several important odex files are copied to the working directory, they are: core.odex, ext.odex, framework . odex, android.policy.odex, services.odex (also can be placed in another directory, by setting BOOTCLASSPATH specified, the default is the current directory, please refer to baksmali on BOOTCLASSPATH help information.)

Download the following tools to $ AndroidDecompile in:

Baksmali:

http://code.google.com/p/smali/downloads/list

Smali:

http://code.google.com/p/smali/downloads/list

Dex2jar:

http://code.google.com/p/dex2jar/downloads/list

JD-GUI (Java Decompile GUI):

http://java.decompiler.free.fr/?q=jdgui <!--[ if! supportNestedAnchors ]--><!--[ endif] ->

AutoSign:

http://d.download.csdn.net/down/2768910/fjfdszj

Apktool

http://code.google.com/p/android-apktool/downloads/list

Suppose we have an application, compile the class file after it took out alone, that there are two files app.apk and app.odex, place them on the next $ AndroidDecompile.

1. Odex file using baksmali.jar the document is divided into smali

$ Java-jar baksmali-1.2.5.jar-x app.odex

If successful, will generate a $ AndroidDecompile out directory, which are to ". Smali" for the file name suffix, in this role does not go into these files.

2. Use smali.jar the out / directory smali files into classes.dex

$ Java-Xmx512M-jar smali-1.2.5.jar out-o classes.dex

classes.dex Dalvik VM is used in the compiled class file format, in the normal apk file will have.

3. Use dex2jar classes.dex decompiled the jar file

After the download dex2jar compressed codecs, which will have dex2jar.sh (and dex2jar.bat) files, documents and dex2jar.sh if classes.dex in the same directory, use the following ways classes.dex decompiled jar File:

$ Dex2jar.sh classes.dex

If successful, it will generate in the current directory, compiled files anti-classes.dex.dex2jar.jar.

dex2jar dex files that can be manipulated, you can directly manipulate apk file, it uses rules:

dex2jar file1.dexORapk file2.dexORapk ...

4. Using the JD-GUI view the anti-compiled jar file

JD-GUI is a visual Java decompiler code viewer, it can be real-time anti-compiled java class file to view the file. Jd-gui extract the downloaded file, perform directory jd-gui executable file to start and then load the previous step in the anti-compiled classes.dex.dex2jar.jar files.

5. From odex classes.dex anti-compiled files and other resources re-packaged into a complete apk

We assume that the above situation is the application compiled class files from apk file is stripped out, here is how to do the steps above to get the classes.dex and apk file in other re-packaged into a usable apk.

First, the anti-compiled classes.dex and original app.apk (excluding classes.dex) re-compressed into a complete app.apk (apk file compression tools available to open), into the app that will classes.dex . apk in.

Unzip the downloaded file AutoSign, you can see signapk.jar (there are a Sign.bat) file, execute the following command to app.apk file signature, to generate a working apk file.

$ Java-jar signapk.jar testkey.x509.pem testkey.pk8 app.apk app_signed.apk

6. Apktool use

There is a tool the Internet is apktool, apk can be resolved, de-compile the resource file, and parse the class file into smali documents; while the files can be parsed into a re-packaged apk. Several features and tools described above is similar to its use as follows:

apktool d app.apk and decompile app.apk to the folder and

apktool b app from the app folder, re-APK, output to ABC \ dist \ out.apk

The specific use will not go, please refer to the official website, or:

http://www.geeka.net/2010/05/apktool-decode-android-google-code/

7. My $ AndroidDecompile screenshot files directory

Android documentation decompile

Third, a number of tools to help information

1. Baksmali help information

usage: java-jar baksmali.jar [options] <dex-file>

disassembles and / or dumps a dex file

-?,-- Help Prints the help message then exits.

-B, - no-debug-info Specify twice for debug options

don't write out debug info (. local,

. Param,. Line, etc.)

-C, - bootclasspath <BOOTCLASSPATH> The bootclasspath jars to use, for

analysis. Defaults to

core.jar: ext.jar: framework.jar: andro

id.policy.jar: services.jar. If the

value begins with a:, it will be

appended to the default

bootclasspath instead of replacing it

-D, - bootclasspath-dir <DIR> The base folder to look for the

bootclasspath files in. Defaults to

the current directory

-F, - code-offsets Add comments to the disassembly

containing the code offset for each address

-L, - use-locals Output the. Locals directive with

the number of non-parameter

registers, rather than the. register

-O, - output <DIR> Directive with the total number of register

the directory where the disassembled

files will be placed. The default is out

-P, - no-parameter-registers Use the v <n> syntax instead of the

p <n> syntax for registers mapped to

method parameters

-R, - register-info <REGISTER_INFO_TYPES> Print the specificed type (s) of

register information for each

instruction. "ARGS, DEST" is the

default if no types are specified.

Valid values are:

ALL: all pre-and post-instruction registers.

ALLPRE: all pre-instruction registers

ALLPOST: all post-instruction registers

ARGS: any pre-instruction registers

used as arguments to the instruction

DEST: the post-instruction

destination register, if any

MERGE: Any pre-instruction register

has been merged from more than 1

different post-instruction register

from its predecessors

FULLMERGE: For each register that

would be printed by MERGE, also show

the incoming register types that

were merged

-S, - sequential-labels Create label names using a

sequential numbering scheme per

label type, rather than using the

bytecode address

-V, - version Prints the version then exits

-X, - deodex Deodex the given odex file. This

option is ignored if the input file

is not an odex file

2. Smali help information

usage: java-jar smali.jar [options] [-] [<smali-file> | folder] *

assembles a set of smali files into a dex file

-?,-- Help prints the help message then exits. Specify twice for

debug options

-O, - output <FILE> the name of the dex file that will be written. The default

is out.dex

-V, - version prints the version then exits

3. Auto-sign with the help of information

SignApk.jar is a tool included with the Android platform source bundle.

testkey.pk8 is the private key that is compatible with the recovery image included in this zip file

testkey.x509.pem is the corresponding certificate / public key

Usage:

java-jar signapk.jar testkey.x509.pem testkey.pk8 update.zip update_signed.zip

4. Apktool help information

Apktool v1.3.2 - a tool for reengineering Android apk files

Copyright 2010 Ryszard Wi? Niewski <[email protected]>

Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)

Usage: apktool [-v | - verbose] COMMAND [...]

COMMANDs are:

d [ecode] [OPTS] <file.apk> [<dir>]

Decode <file.apk> to <dir>.

OPTS:

-S, - no-src

Do not decode sources.

-R, - no-res

Do not decode resources.

-D, - debug

Decode in debug mode. Check project page for more info.

-F, - force

Force delete destination directory.

-T <tag>, - frame-tag <tag>

Try to use framework files tagged by <tag>.

- Keep-broken-res

Use if there was an error and some resources were dropped, eg:

"Invalid config flags detected. Dropping resources", but you

want to decode them anyway, even with errors. You will have to

fix them manually before building.

b [uild] [OPTS] [<app_path>] [<out_file>]

Build an apk from already decoded application located in <app_path>.

It will automatically detect, whether files was changed and perform

needed steps only.

If you omit <app_path> then current directory will be used.

If you omit <out_file> then <app_path> / dist / <name_of_original.apk>

will be used.

OPTS:

-F, - force-all

Skip changes detection and build all files.

-D, - debug

Build in debug mode. Check project page for more info.

if | install-framework <framework.apk> [<tag>]

Install framework file to your system.

Additional info for, See: http://code.google.com/p/android-apktool/

IV References

1. Smali

http://code.google.com/p/smali/

http://www.geeka.net/2010/05/android-apk-odex-classes-dex/

2. ApkTool

http://code.google.com/p/android-apktool/

http://www.geeka.net/2010/05/apktool-decode-android-google-code/

相关文章
  • Android documentation decompile Made by Li Wendong [email protected] 2010-12-13 Monday at a Beijing. Decompile flowchart 2010-12-13

    Android documentation decompile Made by Li Wendong [email protected] 2010-12-13 Monday in Beijing A, decompile flowchart Second, tools to use (command) Preparations Suppose I am working directory for the $ AndroidDecompile, first of all to system.im

  • Android documentation decompile 2010-12-13

    Android documentation decompile Made by Li Wendong [email protected] 2010-12-13 Monday in Beijing A, decompile flowchart Second, tools to use (command) Preparations Suppose I am working directory for the $ AndroidDecompile, first of all to system.im

  • Android program decompile method 2010-09-16

    Apk file format Android application package file. Android platform to be installed for each application package must be compiled into a separate file, suffixes named. Apk, which contains the application binary code, resources, configuration files. ap

  • Android APK decompile 2011-05-27

    One. Decompile Apk get Java source code Reprinted from: http://hi.baidu.com/% CB% BF% D4% B5% CC% EC% CF% C2/blog/item/2284e2debafc541e495403ec.html Tools Download: required to dex2jar and JD-GUI tools that 2 dex2jar Download: http://laichao.googleco

  • Xiang Jie Android's Activity component 2010-03-29

    http://www.ibm.com/developerworks/cn/opensource/os-cn-android-actvt/index.html?ca=drs-cn-0122 Activity of the life cycle And J2ME, MIDlet, as in android in, Activity of the life cycle to the system under unified management. The difference is that wit

  • Chapter IV to explore Android SDK 2010-03-29

    Key skills and concepts l using the Android SDK documentation l using the Android SDK tools l use application examples l to understand the life cycle of Android applications Since you have already built good development environment, you can explore t

  • Chapter VI using the command-line tool with the Android emulator - Next 2010-03-29

    Since you placed in the Android application server, you can delete it. Rm HelloWorldCommandLine.apk use the command syntax to remove the application. The following illustration shows the rm command, if run properly, it will not again feedback. And th

  • Android: Layouts Description 2010-06-24

    Layout Manager (generally called "layouts") is ViewGroup expansion of child controls are designed to control the position of the screen. Layouts can be nested within each other, through a combination of Layout Manager, you can create complex int

  • Android applications in the multimedia file to read 2010-08-05

    Android applications in the multimedia file related to Android to read a database / data / data / com.android.providers.telephony / databases / mmssms.db and a folder / data / data / com.android.providers.telephony / app_parts. Yao backup MMS, Ke Yi

  • android export, installation and unloading explain 2010-10-12

    First install one: first of all need to start the simulator II: start -> run -> CMD Third: The following tools directory into andoridsdk Four: adb install c: \ *. apk (Note: "c: \ *. apk" is the path of the file to be installed) ==========

  • How to become a master android??? (Spare) 2010-10-28

    A: Learn lazy Crazy? Actually learn to program developers lazy? Application developers may be the world's most busy for a class man! Yes, right, learn to lazy! Because programmers are busy, because application developers may be the changing needs of

  • (Rpm) Detailed Android's Activity component 2010-10-29

    While writing this article, feel is the most basic of Activity, but things are still many details, but said very comprehensive, so turn around and share the hope that helps ~ ================================ ================ Text start =============

  • Android developers how to be a 2010-11-21

    In my opinion, want to be a real Android developer, you need to have these things: • Java basic knowledge (or any other object oriented language) • free download of the Android SDK (including Android emulator) • Free IDE (eg Eclipse) • Free Android d

  • Android resources collected 2010-12-23

    Android several books for beginners (for download) http://down.android123.com/android-book.pdf http://attachments.hiapk.com/download/BOOK/Android_1.0_eBook_by_tom_kao_2008_10_15.pdf Good place to start, but traditional http://code.google.com/p/androi

  • Android anti-compiler tool described learning 2011-05-13

    Study notes the anti-Android build tools introduced (Class files decompile, xml files decompile order) Recently a number of online search tools Android file decompile, for your reference. 1.CLASS files decompilation tool: XJAD 2.xml File Tools AXMLPr

  • Common API reference documentation and ORELLY of 58 e-books 2011-09-11

    A collection of some of the commonly used API reference documentation on where the need to prepare in a timely manner: Android documentation C + + CSS3.0 ( tutorial 2 ) DHTML EXT3 Hibernate3.2 Hibernate3.3.1GA J2ME JavaScript JDK6 English JDK6 Chines

  • Common API reference documentation and the 58 e-books ORELLY 2011-09-11

    A collection of some of the commonly used API reference documentation on where the need to prepare in a timely manner: Android documentation C + + CSS3.0 ( tutorial 2 ) DHTML EXT3 Hibernate3.2 Hibernate3.3.1GA J2ME JavaScript JDK6 English JDK6 Chines

  • android应用开发入门 2012-03-13

    1.Android是什么? Android 是Google开发的基于Linux平台的开源手机操作系统.它包括操作系统.用户界面和应用程序 --移动电话工作所需的全部软件,而且不存在任何以往阻碍移动产业创新的专有权障碍.谷歌与开放手机联盟合作开发了Android,这个联盟由包括中国移动.摩托罗拉.高通.宏达和 T-Mobile 在内的 30 多家技术和无线应用的领军企业组成. Android 作为谷歌企业战略的重要组成部分,将进一步推进"随时随地为每个人提供信息"这一企业目标的实现. 2

  • Part 1:Multi-threading Android Apps for Multi-c... 2013-06-08

    As an application developer, why should you care about additional cores in application processors? Some time back, my colleague Liat Ben-Zur asked whether anyone is really taking advantage of multiple cores, and I want to pick up that theme again. Mu

  • 用 Clojure 开发 Android apk 应用程序 2013-12-17

    学了点 Clojure,就忍不住想看看能不能用它来开发 Android 设备上的应用程序,实在是不喜欢 java 代码的萝莉啰嗦,搜了半天,没发现,换一个搜索关键词 "use clojure to create an Android app" 继续搜,结果发现确实有个哥们儿早在2011年就开始研究这个了,写了三篇文章,链接位置在这里[http://www.deepbluelambda.org/2011/02/] 懒得翻译了,反正也没神马生僻词,直接贴过来,做个资料备份: 第一篇: Cr