Android APK Decompile and Rebuild Guide

Apk Decompile & Rebuild Guide

說明:本文僅供學習使用。

WARNING
It is NOT intended for piracy and other non-legal uses. It could be used for localizing, adding some features or support for custom platforms and other GOOD purposes. Just try to be fair with authors of an app, that you use and probably like.

Step 0 - 工具簡介及準備

操作系統
    Win7 Ultimate x64
Java
    Java7

工具
    apktool //用戶獲取Apk中的資源文件,可以取出圖片和佈局文件進行查看。
    dex2jar //將apk反編譯成java源碼(classes.dex轉化成jar文件)
    jd-gui //查看APK中classes.dex轉化成出的jar文件,即源碼文件

install apktool
    https://ibotpeaches.github.io/Apktool/install/

install dex2jar
    https://sourceforge.net/projects/dex2jar/

install jd-gui
    http://jd.benow.ca/

Step 1 - Decompile Java

1 將apk後綴文件改爲zip 並解壓,得到其中的classes.dex,它就是java文件編譯再通過dx工具打包而成的。

2 將classes.dex複製到dex2jar.bat所在目錄dex2jar文件夾。

3轉到dex2jar.bat所在目錄,運行

$ dex2jar.bat classes.dex

生成
classes_dex2jar.jar

4進入jdgui文件夾雙擊jd-gui.exe,打開上面生成的jar包classes_dex2jar.jar,即可看到源代碼.

Step 2 - 反編譯APK圖片 XML 資源等文件

1 到apktool存放目錄下,執行如下cmd

$ apktool.bat d –f will_decompiled.apk newfolder

會得到下圖文件 //這些文件對於Android App 程序員是比較親切的。

Step 3 - Repackage

$apktool b newfolder  //在newfolder內生成了新的Apk.

Step 4 - Signed

用簽名工具簽名。 或者放到ROM中Build。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章