apkTool反編譯apk碰到的問題

xingstarx發表於2018-01-18

在Mac平臺上反編譯了某個知識付費類的app,用的weex技術。發現反編譯不成功

流程如下

  1. 反編譯apk java -jar apktool_2.3.0.jar d xxx_1.0.0_beta_offical.apk

  2. 回編譯(將修改後的檔案重新打包為一個apk) java -jar apktool_2.3.0.jar b xxx_1.0.0_beta_offical

  3. 簽名後安裝到手機上除錯

結果發現在第二步總是不成功,找到https://github.com/iBotPeaches/Apktool/issues/1425 這個issue,發現作者提到了

Seems you might have an outdated framework. Make sure to run apktool empty-framework-dir --force to refresh those.
複製程式碼

完整的回答如下

➜  Bug1425 apktool d app-debug.apk 
I: Using Apktool 2.2.2 on app-debug.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/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...
➜  Bug1425 apktool b app-debug
I: Using Apktool 2.2.2
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...
➜  Bug1425 
複製程式碼

說的是framework過時了,需要在 /home/ibotpeaches/.local/share/apktool目錄下(這個目錄在執行第一步反編譯過程中出現過,那個就是你需要重新執行的目錄)重新執行apktool empty-framework-dir --force

之後重新執行這三步,完美解決問題

特地紀錄一下

相關文章