blog.Ring.idv.tw

Android - Dump your .dex file

Android - Dump your .dex file


由於對於「Google Android」不甚熟悉,所以在上一篇的po文「初探Google Android」我不了解如何Dump出「.dex」檔案中所包含的opcode,還因此麻煩院內的同事(avain) ^^a 幫我詢問相關的資源,雖然沒有直接的解決我所要的需求,不過也提供我一個Google在五月底舉辦的Google I/O所發佈的Dalvik handouts,感謝呢! ^^

還好,今天終於發現了解決方案,原來Android OS就提供了一個「dexdump」的小工具,所以我們可以利用Android SDK所提供的「Android Debug Bridge (adb)」工具來操控Android Emulator,並透過remote shell command來達成我們的需求~

由於我先前已經開發了一個簡單的Android App來測試,所以現在直接啟動Android Emulator,然後執行Android SDK所提供的「Android Debug Bridge (adb)」工具來操作,而我只要輸入下列指令即可Dump出來:

adb shell dexdump -d -f -h /data/dalvik-cache/data@[email protected]@classes.dex > FirstAndroid.txt

接下來就花點時間去讀懂它了~ XDD

........................
source_idx    : 7 (FirstAndroid.java)
insns         : 17 16-bit code units
0004b4:                                        |[0004b4] tw.idv.ring.FirstAndroid.onCreate:(Landroid/os/Bundle;)V
0004b8: fa02 5800 3200                         |0000: +invoke-super-quick {v2, v3}, [0058] // vtable #0058
0004be: 2100 0200                              |0003: new-instance v0, Landroid/widget/TextView; // class@0002
0004c2: 7002 0200 2000                         |0005: invoke-direct {v0, v2}, Landroid/widget/TextView;.<init>:(Landroid/content/Context;)V // method@0002
0004c8: 1801 0000                              |0008: const-string v1, "Hello, Android" // string@0000
0004cc: f802 1e01 1000                         |000a: +invoke-virtual-quick {v0, v1}, [011e] // vtable #011e
0004d2: f802 6f00 0200                         |000d: +invoke-virtual-quick {v2, v0}, [006f] // vtable #006f
0004d8: 0e00                                   |0010: return-void
exceptions    : (none)
positions     : 
        0x0000 line=11
........................

相關資源

{HOWTO} Poke into the dex file

How to decompile .dex file on Android

2008-07-15 23:13:19

Leave a Comment

Copyright (C) Ching-Shen Chen. All rights reserved.

::: 搜尋 :::

::: 分類 :::

::: Ads :::

::: 最新文章 :::

::: 最新回應 :::

::: 訂閱 :::

Atom feed
Atom Comment