Writing patches
Start a bundle
A bundle is the file you publish. It holds your patches, and any Kotlin code they add to apps. reseam bundle init starts one from the patch bundle template, which builds as it is and comes with two working patches.
What you need
- JDK 17.
- The Android SDK, with
ANDROID_HOMEset to its folder. The build compiles your extension code against the newestplatforms/android-*/android.jarit finds there. - The
reseamCLI, on yourPATH. See Install.
1. Create the bundle
reseam bundle init my-patches
cd my-patches
This downloads the template into the folder my-patches and names the bundle my-patches. Pick your own name: lowercase letters and digits, separated by single hyphens. Patch references use it, so keep it once you publish. The command also sets the Reseam Gradle plugin to the version of your CLI, so the bundle builds for the engine you test with.
The bundle contains:
manifest.toml the bundle's name, author, and description
settings.gradle.kts the Reseam plugin version
apps/example/patch/ two example patches
apps/example/extensions/screenshots/
Kotlin code one of the patches adds to the app
.github/workflows/ a release workflow
Both example patches work on any app:
- Enable debugging marks the app debuggable in its manifest, so
adbcan attach to it. - Allow screenshots sends the app's "block screenshots" calls to Kotlin code from the bundle, which removes that flag.
2. Make a signing key
Every bundle is signed. Users trust your public key once, and Reseam refuses any bundle that isn't signed with a key they trust. Make yours:
reseam bundle keygen --out ~/.reseam/bundle-signing.key
It prints the public key. You can print it again later with reseam bundle pubkey --key ~/.reseam/bundle-signing.key.
Keep the key file private, and out of the repository. The build reads it from this path. Back it up too: if you lose it, every user has to trust a new key.
3. Build
./gradlew bundle
The bundle is written to build/reseam/my-patches.reseam.
4. Try it on an app
List what is inside, then patch an APK you have:
reseam bundle list build/reseam/my-patches.reseam
reseam patch app.apk \
--bundle build/reseam/my-patches.reseam \
--trust <public key> \
--enable "Enable debugging" \
--output patched.apk
The example patches work on any app, so they start switched off, and --enable turns one on. Install the result with adb install patched.apk. If the app is already installed from a store, uninstall it first: Android only installs an update signed with the same key as the installed app.
5. Make it yours
- Set
authoranddescriptioninmanifest.toml. - Rename
apps/exampleto the app you patch, and theapp.examplepackages to your own. - Replace the example patches with yours.
Next: Your first patch.