Android APK Decompile and Rebuild Guide

来源:互联网 发布:java项目遇到的难题 编辑:程序博客网 时间:2024/05/23 02:04

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。
0 0
原创粉丝点击