{"slug": "full-tutorial-to-patch-apks-on-android-using-apk-mitm-and-apklab-support-for", "title": "Full tutorial to patch APKs on Android using apk-mitm and APKLab. Support for bundle APKs.", "summary": "This article provides a tutorial for patching Android APKs using the tools apk-mitm and APKLab, including support for bundle APKs (multiple APK files). It outlines steps to extract, decompile, edit, rebuild, and sign APKs, with specific instructions for handling single APKs versus bundle APKs using Split APKs Installer (SAI). The process concludes with installing the patched app on a device and optionally using a proxy SSL certificate for network inspection.", "body_md": "## Patch APK\n\nFull tutorial to patch APKs on Android using [apk-mitm](https://github.com/shroudedcode/apk-mitm) and [APKLab](https://github.com/APKLab/APKLab). Support for bundle APKs.\n\n### Pull APK\n\n```sh\nadb shell pm list packages\nadb shell pm path <package_name>\n```\n\nIf the app contains a single APK:\n\n```sh\nadb pull /data/app/~~SzA2evEyrPV2ucUpwPzYYQ==/some_path==/base.apk base.apk\n```\n\nIf it's a bundle APK (multiple APK files):\n\n- Install [Split APKs Installer (SAI)](https://play.google.com/store/apps/details?id=com.aefyr.sai)\n- Backup the app to a `.apks` file\n- Load the file to your computer\n- Extract the `.apks` file (it's an archive!)\n- Create a copy of the `.apks` file, we will need it later when rebuilding the app\n\n### Patch APK\n\nOpen `base.apk` with [APKLab](https://github.com/APKLab/APKLab) with options:\n\n- Only main classes\n- Decompile Java\n\nInspect the Java code in the `java_src` directory, find the function you want to edit.\n\nWhen found, go to its `.smali` file equivalent in the `smali` directory, do your edit and save.\n\nRight-click on the `apktool.yml` file: `APKLab: Rebuild the APK`.\n\nThe APK file is generated at `dist/base.apk`.\n\nIf you are working on a single APK, you can install it to your phone:\n\n```sh\nadb install dist/base.apk\n```\n\n### Build bundle APK\n\n- Open your copy of the `.apks` file as an archive\n- Delete the `base.apk` file from the archive\n- Add your `dist/base.apk` patch APK file to the archive\n\nUsing [apk-mitm](https://github.com/shroudedcode/apk-mitm)\n\n```sh\napk-mitm my_app-edited.apks\n```\n\n```\n\n  ╭ apk-mitm v1.2.1\n  ├ apktool v2.6.1\n  ╰ uber-apk-signer v1.2.1\n\n  Using temporary directory:\n  /tmp/apk-mitm-ab640ef99e9eacd6b96f033651301328\n\n  ✔ Extracting APKs\n  ✔ Patching base APK\n  ✔ Signing APKs\n  ✔ Compressing APKs\n\n   Done!  Patched file: ./my_app-edited-patched.apks\n```\n\n### Quick SSL/HTTPS MITM patch\n\nUse the `--certificate` parameter your proxy SSL certificate\n\n```sh\napk-mitm --certificate charles_proxy_certificate.pem my_app-edited.apks\n```\n\n### Install bundle APK\n\n- Load the `my_app-edited-patched.apks` file to your phone\n- Install [Split APKs Installer (SAI)](https://play.google.com/store/apps/details?id=com.aefyr.sai)\n- Install it\n\nEnjoy! 💕\n", "url": "https://wpnews.pro/news/full-tutorial-to-patch-apks-on-android-using-apk-mitm-and-apklab-support-for", "canonical_source": "https://gist.github.com/rigwild/02729a128b878186ffe8b1982d31b4f4", "published_at": "2022-07-19 04:18:32+00:00", "updated_at": "2026-05-22 14:45:19.701213+00:00", "lang": "en", "topics": ["developer-tools", "cybersecurity"], "entities": ["APKLab", "apk-mitm", "APKTool", "uber-apk-signer", "SAI"], "alternates": {"html": "https://wpnews.pro/news/full-tutorial-to-patch-apks-on-android-using-apk-mitm-and-apklab-support-for", "markdown": "https://wpnews.pro/news/full-tutorial-to-patch-apks-on-android-using-apk-mitm-and-apklab-support-for.md", "text": "https://wpnews.pro/news/full-tutorial-to-patch-apks-on-android-using-apk-mitm-and-apklab-support-for.txt", "jsonld": "https://wpnews.pro/news/full-tutorial-to-patch-apks-on-android-using-apk-mitm-and-apklab-support-for.jsonld"}}