DexPatcher

A toolchain for modifying Android APK files at source-level using Java, graphical resource editors, and the full power of Android Studio in all major platforms.

Fully integrated with Android Studio and the Gradle build system.

Includes support for coding assistance and on-demand class decompilation.

Patch Java code in Java using declarative syntax provided by the DexPatcher tool.

Manifest merging enables piece-wise changes to the original app manifest.

Modify existing resources or create new ones using Android Studio's standard resource editors.

Use Android Studio's code template wizards for creating activities, etc.

Pull in Android libraries (a.k.a. '.aar' Android archives) and have their manifests, code and resources automatically merged into the patched app.

And enjoy debugging support.

All in your favorite platform: Linux, Windows or macOS.

DexPatcher tool (Dalvik bytecode patcher)

DexPatcher Gradle plugins (Android build system and Android Studio integration)

Deprecated tools

License

Documentation

START HERE !

Clone the samples. Start with the 'patched-app' sample: open the project with Android Studio, disable instant run, and run or debug your patched app!

Install the support tools by cloning the repo anywhere you like. Clone the 'v1' branch of the samples. Set the 'dexpatcher.dir=<support-tool-dir>' property in identical files named 'local.properties' in the root directory of each sample so that it points to your local clone of the support tools. Create the files if necessary, or have Android Studio create them for you by opening the samples. Start with the 'patched-app' sample: open the project with Android Studio, disable instant run, and run or debug your patched app!

OLD NEWS:

DexPatcher Featured On XDA Portal !

LICENSING UPDATE:

patches

Recent versions of DexPatcher no longer require that users bundle the DexPatcher annotations with every patch (although continuing to do so has no ill effects). The DexPatcher licensing terms no longer impose licensing restrictions on patches , as long as users refrain from bundling the DexPatcher annotations with them. In particular, DexPatcher patches are no longer considered to be derivative works of DexPatcher and thus are no longer automatically covered by the GPL. Legals aside, the DexPatcher project urges you not to use copyright laws to introduce artificial scarcity in the world. Please give back to the community: share your work.

XDA:DevDB Information

DexPatcher, Tool/Utility for all devices (see above for details)

Contributors

Version Information

Release notes: https://github.com/DexPatcher/dexpatcher-tool/releases Sources: https://github.com/DexPatcher/dexpatcher-tool Release notes: https://github.com/DexPatcher/dexpat...radle/releases Artifacts: https://plugins.gradle.org/search?term=dexpatcher Sources: https://github.com/DexPatcher/dexpatcher-gradle Samples: https://github.com/DexPatcher/dexpatcher-gradle-samples Release notes for DexPatcher Gradle v1 plugins: https://github.com/DexPatcher/dexpat...=v2.0.0-alpha1 Support tools for DexPatcher Gradle v1 plugins: https://github.com/DexPatcher/dexpatcher-gradle-tools Workflow automation scripts (Linux-only): https://github.com/DexPatcher/dexpatcher-tool-scripts GPL v3 (or later)- The DexPatcher tool uses JesusFreke's(part of smali) to read and write dex files. Many thanks to him for repeatedly helping me in #smali on freenode. When creating apk libraries, the DexPatcher Gradle plugin uses iBotPeaches'to decode compiled resources and pxb1988'sto translate Dalvik bytecode. DexPatcher could not exist without the invaluable work of these guys.The DexPatcher tool uses declarative semantics based on Java annotations to patch the bytecode of the source application. There is no formal definition but hopefully you will find everything you need in this sample:Get the sample code working, here is how:Please review the release notes of recent versions of the Gradle plugins for more information on tool compatibility and environment setup.In the 'patched-app' sample, browse the two 'build.gradle' files ( main and app ) to get an idea of what is happening. The plugins used are briefly described here . Next get inside the 'app' subproject and take a look at its manifest and resource files . These files are merged with the ones coming from the source app, which is located in the 'apk' directory . Finally look into the 'MainActivity.java' file to see how the compiled code of the app is patched using Java. This is handled by the DexPatcher tool, a key piece of the DexPatcher toolchain. See the section 'Patching Java code in Java' above for more details on this tool, and please review its recent release notes The DexPatcher Gradle plugins use Apktool to decode applications and optionally create APK libraries. They optionally use dex2jar to display decompiled application code and to import application code symbols into patch projects. They use the DexPatcher tool to patch the Dalvik bytecode of applications. And finally they use the Andoird build system to merge manifests, code, resources, assets, and extra files, and to repackage applications.To get the old sample code working:Please review the old release notes of the Gradle v1 plugins for more information on tool compatibility and environment setup.GermainZ wrote an excellent introductory article for XDA that walks you though the complete process of modding an app using the old deprecated Linux-only workflow automation scripts. This only covers the DexPatcher tool itself, ie: only patching of code, not resources. The workflow is deprecated, but the Java patch code and accompanying explanations are very valuable and continue to be current. I am grateful to him for having taken the time to do this. Please make sure you give it a read:Also available: [Deprecated, Linux-only]DexPatcherare no longer forcefully covered by the GPL.Stable2015-03-212019-11-09