mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 01:02:22 +01:00
0abf1c6c02
Fingerprints can now be matched easily without adding them to a patch first. BREAKING CHANGE: Many APIs have been changed.
111 lines
5 KiB
Markdown
111 lines
5 KiB
Markdown
<p align="center">
|
|
<picture>
|
|
<source
|
|
width="256px"
|
|
media="(prefers-color-scheme: dark)"
|
|
srcset="../assets/revanced-headline/revanced-headline-vertical-dark.svg"
|
|
>
|
|
<img
|
|
width="256px"
|
|
src="../assets/revanced-headline/revanced-headline-vertical-light.svg"
|
|
>
|
|
</picture>
|
|
<br>
|
|
<a href="https://revanced.app/">
|
|
<picture>
|
|
<source height="24px" media="(prefers-color-scheme: dark)" srcset="../assets/revanced-logo/revanced-logo.svg" />
|
|
<img height="24px" src="../assets/revanced-logo/revanced-logo.svg" />
|
|
</picture>
|
|
</a>
|
|
<a href="https://github.com/ReVanced">
|
|
<picture>
|
|
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://i.ibb.co/dMMmCrW/Git-Hub-Mark.png" />
|
|
<img height="24px" src="https://i.ibb.co/9wV3HGF/Git-Hub-Mark-Light.png" />
|
|
</picture>
|
|
</a>
|
|
<a href="http://revanced.app/discord">
|
|
<picture>
|
|
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
|
|
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
|
|
</picture>
|
|
</a>
|
|
<a href="https://reddit.com/r/revancedapp">
|
|
<picture>
|
|
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
|
|
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
|
|
</picture>
|
|
</a>
|
|
<a href="https://t.me/app_revanced">
|
|
<picture>
|
|
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
|
|
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
|
|
</picture>
|
|
</a>
|
|
<a href="https://x.com/revancedapp">
|
|
<picture>
|
|
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/93124920/270180600-7c1b38bf-889b-4d68-bd5e-b9d86f91421a.png">
|
|
<img height="24px" src="https://user-images.githubusercontent.com/93124920/270108715-d80743fa-b330-4809-b1e6-79fbdc60d09c.png" />
|
|
</picture>
|
|
</a>
|
|
<a href="https://www.youtube.com/@ReVanced">
|
|
<picture>
|
|
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
|
|
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
|
|
</picture>
|
|
</a>
|
|
<br>
|
|
<br>
|
|
Continuing the legacy of Vanced
|
|
</p>
|
|
|
|
# 💉 Introduction to ReVanced Patcher
|
|
|
|
To create patches for Android apps, it is recommended to know the basic concept of ReVanced Patcher.
|
|
|
|
## 📙 How it works
|
|
|
|
ReVanced Patcher is a library that allows modifying Android apps by applying patches.
|
|
It is built on top of [Smali](https://github.com/google/smali) for bytecode manipulation and [Androlib (Apktool)](https://github.com/iBotPeaches/Apktool)
|
|
for resource decoding and encoding.
|
|
|
|
ReVanced Patcher receives a list of patches and applies them to a given APK file.
|
|
It then returns the modified components of the APK file, such as modified dex files and resources,
|
|
that can be repackaged into a new APK file.
|
|
|
|
ReVanced Patcher has a simple API that allows you to load patches from RVP (JAR or DEX container) files
|
|
and apply them to an APK file. Later on, you will learn how to create patches.
|
|
|
|
```kt
|
|
val patches = loadPatchesFromJar(setOf(File("revanced-patches.rvp")))
|
|
|
|
val patcherResult = Patcher(PatcherConfig(apkFile = File("some.apk"))).use { patcher ->
|
|
// Here you can access metadata about the APK file through patcher.context.packageMetadata
|
|
// such as package name, version code, version name, etc.
|
|
|
|
// Add patches.
|
|
patcher += patches
|
|
|
|
// Execute the patches.
|
|
runBlocking {
|
|
patcher().collect { patchResult ->
|
|
if (patchResult.exception != null)
|
|
logger.info { "\"${patchResult.patch}\" failed:\n${patchResult.exception}" }
|
|
else
|
|
logger.info { "\"${patchResult.patch}\" succeeded" }
|
|
}
|
|
}
|
|
|
|
// Compile and save the patched APK file components.
|
|
patcher.get()
|
|
}
|
|
|
|
// The result of the patcher contains the modified components of the APK file that can be repackaged into a new APK file.
|
|
val dexFiles = patcherResult.dexFiles
|
|
val resources = patcherResult.resources
|
|
```
|
|
|
|
## ⏭️ What's next
|
|
|
|
The next page teaches the fundamentals of ReVanced Patches.
|
|
|
|
Continue: [🧩 Introduction to ReVanced Patches](2_patches_intro.md)
|