Continuing the legacy of Vanced
To create patches for Android apps, it is recommended to know the basic concept of ReVanced Patcher.
ReVanced Patcher is a library that allows modifying Android apps by applying patches. It is built on top of Smali for bytecode manipulation and Androlib (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.
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
The next page teaches the fundamentals of ReVanced Patches.
Continue: 🧩 Introduction to ReVanced Patches