- 将 DEX 反编译为 Java 源代码
How can one decompile Android DEX (VM bytecode) files into corresponding Java sourcecode?
Get these tools:
1) dex2jar to translate dex files to jar files
2) jd-gui to view the java files in the jar
The source code is quite readable as dex2jar makes some optimizations.
And here's the procedure on how to decompile:
Convert classes.dex in test_apk-debug.apk to test_apk-debug_dex2jar.jar
d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apk
Note: In the Windows machines all the
.shscripts are replaced by
Open the jar in JD-GUI
To clarify somewhat, there are two major paths you might take here depending on what you want to accomplish:
Decompile the Dalvik bytecode (dex) into readable Java source. You can do this easily with dex2jar and jd-gui, as fred mentions. The resulting source is useful to read and understand the functionality of an app, but will likely not produce 100% usable code. In other words, you can read the source, but you can't really modify and repackage it. Note that if the source has been obfuscated with proguard, the resulting source code will be substantially more difficult to untangle.
The other major alternative is to disassemble the bytecode to smali, an assembly language designed for precisely this purpose. I've found that the easiest way to do this is with apktool. Once you've got apktool installed, you can just point it at an apk file, and you'll get back a smali file for each class contained in the application. You can read and modify the smali or even replace classes entirely by generating smali from new Java source (to do this, you could compile your .java source to .class files with javac, then convert your .class files to .dex files with Android's dx compiler, and then use baksmali (smali disassembler) to convert the .dex to .smali files, as described in this question. There might be a shortcut here). Once you're done, you can easily package the apk back up with apktool again. Note that apktool does not sign the resulting apk, so you'll need to take care of that just like any other Android application.
If you go the smali route, you might want to try APK Studio, an IDE that automates some of the above steps to assist you with decompiling and recompiling an apk and installing it on a device.
In short, your choices are pretty much either to decompile into Java, which is more readable but likely irreversible, or to disassemble to smali, which is harder to read but much more flexible to make changes and repackage a modified app. Which approach you choose would depend on what you're looking to achieve.
Lastly, the suggestion of dare is also of note. It's a retargeting tool to convert .dex and .apk files to java .class files, so that they can be analyzed using typical java static analysis tools.
Once you downloaded your APK file , You need to do the following steps to get a editable java code/document.
- 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.
You might try JADX (https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler), this is a perfect tool for DEX decompilation.
And yes, it is also available online on (my :0)) new site: http://www.javadecompilers.com/apk/
Easiest method to decompile an android app is to download an app named ShowJava from playstore . Just select the application that needs to be decompiled from the list of applications. There are three different decompiler you can use to decompile an app namely -
CFR 0.110, JaDX 0.6.1 or FernFlower (analytical decompiler) .
Recent Debian have Python package
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
Install corresponding packages:
sudo apt-get install androguard python-networkx
Decompile DEX file:
$ androdd -i classes.dex -o ./dir-for-output
classes.dex from Apk + Decompile:
$ androdd -i app.apk -o ./dir-for-output
Apk file is nothing more that Java archive (JAR), you may extract files from archive via:
$ unzip app.apk -d ./dir-for-output
First you need a tool to extract all the (compiled) classes on the DEX to a JAR.
There's one called dex2jar, which is made by a chinese student.
Then, you can use jd-gui to decompile the classes on the JAR to source code.
The resulting source should be quite readable, as dex2jar applies some optimizations.
You can use APKTool. It will automatically extract all the classes (
.dex), resources (
.asrc), then it will convert binary XML to human-readable XML, and it will also dissassemble the classes for you.
Disassembly will always be more robust than decompiling, especially with
JARs obfuscated with Pro Guard!
Just tell APKTool to decode the APK into a directory, then modify what you want,
and finally encode it back to an APK. That's all.
Important: APKTool dissassembles. It doesn't decompile.
The generated code won't be Java source.
But you should be able to read it, and even edit it if you're familiar with jasmin.
If you want Java source, please go over the Manual way.
Sometimes you get broken code, when using
apktool, most notably in loops. To avoid this, use jadx, which decompiles dalvik bytecode into java source code, without creating a
.class file first as
dex2jar does (apktool uses dex2jar I think). It is also open-source and in active development. It even has a GUI, for GUI-fanatics. Try it!
I'd actually recommend going here: https://github.com/JesusFreke/smali
It provides BAKSMALI, which is a most excellent reverse-engineering tool for DEX files. It's made by JesusFreke, the guy who created the fameous ROMs for Android.
android 反编译工具包 class.dex转换成.class2012-11-05
Android反编译工具包，命令行方式，首先用解压缩软件将 apk 包里的 class.dex 解压出来 ，然后和下载的文件放在一起，运行 bat 可以的到 out目录，需要将 java 配置到 pa
AndroidKiller小插件，多dex转java源码，无需重启AndroidKiller直接打开jdgui即可看代码，无需手动反编译dex2,3,4,5，省时省力。 ps: 这是解决多dex编译源
android反编译工具包apktool dex反编译class工具包dex2jar jar包查看工具包jdgui 以上三个软件合集
- 博客 NQG传统算法（非预训练算法）-- copy机制
- 博客 前端向后台传值的5种方式总结
- 学院 Mysql数据库进阶/引擎/分组/连接/子查询/事务/Django框架的model
- 学院 从新手小白入门Qt编程(Windows 10)
- 下载 H_infinity.zip
- 下载 WHWLinkLabal.zip
- 博客 PBC Library Manual（PBC库手册）翻译(六)
- 博客 正则表达式中\L、\Q和\E的用法
- 学院 标杆徐Linux微课堂: Nginx动静分离/Nginx+uWSGI+Django生产环境部署实践
- 学院 Windows版YOLOv4-tiny目标检测实战：训练自己的数据集
- 学院 黑客帝国流星雨（Java）
- 下载 pic_mnistdata.zip
- 博客 我靠(call) ，我的未来(Future)在哪里？？？
- 下载 saz2action.py
- 学院 Java全栈工程师-Spring Security
- 学院 Linux运维与云计算实战指南2020版-零起点基础篇
- 学院 Composer精讲及搭建自己的PHP开发框架
- 学院 基于vue-element-admin的后台权限验证系统
- 博客 epoll+server
- 博客 Spring学习（4）——IOC容器中的自动装配
- 下载 ssm乐吃零食销售系统毕业设计程序
- 博客 2020-08-06
- 学院 测试课程编辑1
- 下载 06BCD_counter.rar
- 学院 标杆徐Linux微课堂: Jumpserver（2.0.1版本）堡垒机快速入门与实践
- 下载 texstudio-2.12.22-win-qt5.7z
- 博客 Road To The 3rd Building HDU - 6827(期望)
- 博客 javasc原生Ajax详解
- 博客 git入门使用
- 博客 Tomcat面试题