如何将Android DEX(虚拟机字节码)文件反编译成相应的Java源代码?
当前回答
您可以尝试JADX (https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler),这是一个完美的DEX反编译工具。
是的,它也可以在线(my:0))新网站:http://www.javadecompilers.com/apk/
其他回答
下载APK文件后,您需要执行以下步骤以获得可编辑的java代码/文档。
Convert your apk file to zip (while start your download don't go with "save" option , just go with "save as" and mention your extension as .zip) by doing like this you may avoid APKTOOL... Extract the zip file , there you can find somefilename.dex. so now we need to convert dex -> .class To do that, you need "dex2jar"(you can download it from http://code.google.com/p/dex2jar/ , after extracted, in command prompt you have to mention like, [D:\dex2jar-0.09>dex2jar somefilename.dex] (Keep in mind that your somefilename.dex must be inside the same folder where you have keep your dex2jar.) Download jad from http://www.viralpatel.net/blogs/download/jad/jad.zip and extract it. Once extracted you can see two files like "jad.exe" and "Readme.txt" (sometimes "jad.txt" may there instead of "jad.exe", so just rename its extension as.exe to run) Finally, in command prompt you have to mention like [D:\jad>jad -sjava yourfilename.class] it will parse your class file into editable java document.
您可以尝试JADX (https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler),这是一个完美的DEX反编译工具。
是的,它也可以在线(my:0))新网站:http://www.javadecompilers.com/apk/
自从这些答案被发布以来,很多事情都发生了变化。现在有很多简单的GUI工具,比如:
APK Easy Tool for Windows (GUI tool, friendly)
Bytecode Viewer - APK/Java Reverse Engineering Suite
URET Android Reverser Toolkit
找到他们最好的地方是在XDA开发者论坛上。
最近Debian有Python包androguard:
Description-en: full Python tool to play with Android files
Androguard is a full Python tool to play with Android files.
* DEX, ODEX
* APK
* Android's binary xml
* Android resources
* Disassemble DEX/ODEX bytecodes
* Decompiler for DEX/ODEX files
安装相应的软件包:
sudo apt-get install androguard python-networkx
反编译DEX文件:
$ androdd -i classes.dex -o ./dir-for-output
从Apk +反编译中提取classes.dex:
$ androdd -i app.apk -o ./dir-for-output
Apk文件就是Java的JAR文件,你可以通过以下方法从JAR文件中提取文件:
$ unzip app.apk -d ./dir-for-output
在使用dex2jar/apktool时,有时会出现坏代码,最明显的是在循环中。为了避免这种情况,可以使用jadx,它可以将dalvik字节码反编译成java源代码,而不需要像dex2jar那样先创建.jar/.class文件(我认为apktool使用dex2jar)。它也是开源的,正在积极开发中。它甚至有一个GUI,专为GUI爱好者设计。试一试!
推荐文章
- 为什么MongoDB Java驱动在条件中使用随机数生成器?
- 即使从未抛出异常,使用try-catch块的代价是否昂贵?
- 什么时候我们应该使用观察者和可观察对象?
- ImageView -有高度匹配宽度?
- 如何确定在android文件的MIME类型?
- Java中的split()方法对点(.)不起作用。
- Eclipse调试器总是阻塞在ThreadPoolExecutor上,没有任何明显的异常,为什么?
- 这是在Android中获取用户位置的好方法
- Java生成两个给定值之间的随机数
- Android从左到右幻灯片动画
- 如何有效地从数组列表或字符串数组中删除所有空元素?
- 比较JUnit断言中的数组,简洁的内置方式?
- 如何检索视图的维度?
- 如何改变菜单项的文本颜色在安卓?
- codestyle;把javadoc放在注释之前还是之后?