android odex反编译方法一般采用的是baksmali.jar和smali.jar。
可参考:
http://blog.csdn.net/lanmanck/article/details/7527793
http://blog.chinaunix.net/uid-21356596-id-3579100.html
以及github可用工具:https://github.com/RichieWan9/decompile
但是,smali.jar却不支持art odex文件的反编译,问题详细描述https://github.com/rallat/smali/issues/233。
pm.jar直接解压缩可看到只有META-INF文件夹,该处有详细分析:https://github.com/cnzx219/my-note/blob/master/2015/decompile-dalvik-cache.md。
但在github找到ota2dex.jar可用于art odex的反编译。github地址:https://github.com/testwhat/SmaliEx
可在此处下载ota2dex.jar: https://github.com/testwhat/SmaliEx/releases
可参考http://wenku.baidu.com/link?url=GKG6UZy3xAp3jx2RAZ5x7m_AsOD2AGJ3edLVrJNJqwZGywMn_61KXod9Xqd2iVAMTUKLGgcLkGmm7vuZgwabsVjsLvoY7qcAj-T_AZlkb7a
运行步骤:
1.找到pm.jar所在位置:/system/framework
2.从 /system/framework的arm或arm64 目录里拿到 boot.oat 和 pm.odex
2. 执行 java -jar oat2dex.jar boot boot.oat; 这会在 boot.oat 所在目录下生成 dex odex 两个子目录
3. 执行 java -jar oat2dex.jar pm.odex dex/ ; 生成 pm.dex
4.pm.dex采用dex2jar转为jar,再用jd-gui查看源码
如果运行报错如下:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/rh/smaliex/Main : Unsupported major.minor version 52.0
说明是java版太低,该处提供了java7的https://github.com/testwhat/SmaliEx/releases/tag/0.83
android ART的核心文件oat介绍:http://blog.csdn.net/luoshengyang/article/details/39307813