當(dāng)我們遇到一個(gè)很炫的App,都會想去模仿實(shí)現(xiàn)。但通常App都會經(jīng)過混淆才發(fā)布的,所以我們需要反編譯。
工具
- dex2jar:將dex轉(zhuǎn)換成jar的工具
- 最新的下載地址:dex2jar地址
- jdgui : 將編譯好的jar可視化
- apktool : 反編譯出apk中的資源文件
- 最新下載地址:apktool地址
我在Github上傳了這些工具,也可以來我的Github下載
dex2jar使用
目的:反編譯得到Java文件
- 直接解壓要反編譯的Apk文件,得到
classes.dex - 將
classes.dex拷貝到 dex2jar-2.0文件夾里面 - 在dex2jar-2.0文件夾里面執(zhí)行命令行(shift+右鍵 -> 在此處打開命令窗口) , 執(zhí)行:
d2j-dex2jar.bat classes.dex - 然后就得到了
classes_dex2jar.jar - 使用
jd-gui.exe打開classes_dex2jar.jar就可以看到j(luò)ava文件啦??!
apktool使用
目的: 反編譯得到資源文件
- 直接把要反編譯的apk放到apktool文件夾里面
- 在apktool文件夾里面執(zhí)行命令行(shift+右鍵 -> 在此處打開命令窗口) , 執(zhí)行:
apktool d test.apk, 然后就會生成test文件夾 - 然后繼續(xù)執(zhí)行
apktool b test重新構(gòu)建apk - 然后就得到我們需要的資源文件啦
過程如下:
$ apktool d test.apk
I: Using Apktool 2.2.2 on test.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: 1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
$ apktool b test
I: Using Apktool 2.2.2 on test
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
I: Copying unknown files/dir...
如果有用,記得點(diǎn)個(gè)贊鼓勵一下哈