apktool 打包解包apk的总结

Posted johnsonshu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apktool 打包解包apk的总结相关的知识,希望对你有一定的参考价值。

1) 不需要另外下载 baksmali-2.1.2.jar, apktool.jar 好像都包含了。 

apktool d zhanqi.xxx.apk -o zhanqi

2) smalidea-0.03.zip 的 android Studio插件装上之后,就可以调试 1) 生成的 smali 文件了

https://github.com/JesusFreke/smali/wiki/smalidea

  1. Manually disassemble an application using baksmali into a "src" subdirectory of a new project directory, e.g. baksmali myapp.apk -o ~/projects/myapp/src
  2. In IDEA, import a new project, and select the project directory. e.g. ~/projects/myapp
  3. Use the "Create project from existing sources" option when importing the project
  4. Once the project has been created, right click on the src directory and select "Mark Directory As->Sources Root"
  5. Open the project settings and select/create an appropriate JDK
  6. Install/start the application on the device
  7. Run ddms, and select the application‘s process
  8. In IDEA, Create a new "Remote" debug configuration (Run->Edit Configurations), and change the debug port to 8700
  9. Run->Debug
  10. The application should pause if/when the breakpoint is hit, at which point you can single step, add watches, etc.

3)重新打包decomplie出来的smali

D:\proj\android>apktool b zhanqi
I: Using Apktool 2.1.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building apk file...
I: Copying unknown files/dir...

4)重新签名打包的apk 文件

   a) 下载sign.jar 和 signapk.jar  https://github.com/appium/sign

   b) 会生成 .s.apk 文件

    

D:\proj\android>java -jar sign.jar .\zhanqi\dist\zhanqi_v2_6_8.apk

D:\proj\android>adb install .\zhanqi\dist\zhanqi_v2_6_8.s.apk

 

5)启动app时就截住断点的方法

 

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 4

    .prologue
    .line 66
    invoke-static {}, Landroid/os/Debug;->waitForDebugger()V

 

以上是关于apktool 打包解包apk的总结的主要内容,如果未能解决你的问题,请参考以下文章

APK使用APKTOOL命令行进行解包和重新打包

APK使用APKTOOL命令行进行解包和重新打包

APK使用APKTOOL命令行进行解包和重新打包

PHP利用apktool.jar自动打包解包

apk文件的解包和打包操作

Android 逆向逆向修改游戏应用 ( APK 解析工具 | 解包 -> 分析 -> 重打包 -> 签名 流程 )