https://ibotpeaches.github.io/Apktool/install/
参考红圈里的步骤处理即可
apktool d ./xxxx_v5.4.apk
注意这里有可能因为assert目录下(或者其他地方)有加密的dex而导致反编译报错
比如以下日志
I: Baksmaling assets/39285EFA.dex...
Exception in thread "main" org.jf.dexlib2.dexbacked.DexBackedDexFile$NotADexFile: Not a valid dex magic value: cf 77 4c c7 9b 21 01 cd
at org.jf.dexlib2.util.DexUtil.verifyDexHeader(DexUtil.java:93)
at org.jf.dexlib2.dexbacked.DexBackedDexFile.getVersion(DexBackedDexFile.java:157)
at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:81)
at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:184)
at org.jf.dexlib2.dexbacked.ZipDexContainer$1.getDexFile(ZipDexContainer.java:181)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:89)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:37)
at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:103)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:151)
at brut.apktool.Main.cmdDecode(Main.java:175)
at brut.apktool.Main.main(Main.java:79)
这是需要增加一个参数--only-main-classes
参数解释:
只反编译apk根目录下的dex文件,如:classes[0-9].dex
通过阅读源码发现,此配置的作用为:反编译根目录下的以 classes 开头,并以 .dex 结尾的dex文件,不仅限于0-9
整体命令(--only-main-classes不可放在最后,2.7版本会报错)
apktool d --only-main-classes ./xxx_v5.4.apk
反编译成功