ReVanced / revanced-manager

💊 Application to use ReVanced on Android
https://revanced.app
GNU General Public License v3.0
18.55k stars 753 forks source link

feat: merge bundle option/merge upon patching #2143

Open OldManJenkins12 opened 3 months ago

OldManJenkins12 commented 3 months ago

Feature description

  1. A new option to simply merge app bundles/split apk's
  2. If the manager sees the user giving it an app bundle/split APK when patching, it merges then patches

Motivation

  1. Some people may simply want to install an apk, but not patch, so on the bottom of the manager there could be a "merger" option which would simply merge the provided file to an APK, android app bundles can target the specific device, so the manager would target the specific device when signing

  2. As the play store now only provides bundles for some apps, this makes it harder to patch apps, forcing the user to use older versions of the app in order to get the APK and then patch, so to continue using newer versions, and patching apps that the play store only provides bundles for, it's best for the manager to automatically merge the provided file, then patch the app, targeting the specific device upon merging

  3. As this would be in revanced manager people wouldn't need to install tools to merge (which can end up giving corrupted/broken apk's) and people can simply stick to revanced, this is especially helpful if they're low on storage or just don't want to install these tools, and revanced would/should give a safe and fully working apk. This being in the manager also makes it much easier and quicker to patch/merge bundles/split apk's

Acknowledgements

Mehlsine commented 3 months ago

There's an issue with MinSdkVersionException being raised during merged APK signing that one of ReVanced Manager's maintainers is not willing to acknowledge by simply referring to it as "broken APK", so I doubt there's going to be some work on your proposal in the near future. Please refer to this https://github.com/ReVanced/revanced-manager/issues/2083#issuecomment-2253313362 if you want to know the details.

Meanwhile, you can merge split APKs using 3rd party tools (for example, Antisplit function in Apktool M) and use this modified ReVanced Manager to patch merged APK without getting any exceptions in the process: https://github.com/AbdurazaaqMohammed/revanced-antisplit

oSumAtrIX commented 3 months ago

This is false information and also the last time I will allow it to be posted on this organization. The issue you linked contains the explanation on why.

kitadai31 commented 3 months ago

@OldManJenkins12

A new option to simply merge app bundles/split apk's

Some people may simply want to install an apk, but not patch, so on the bottom of the manager there could be a "merger" option which would simply merge the provided file to an APK, android app bundles can target the specific device, so the manager would target the specific device when signing

To install a bundle APK, you don't have to merge it into a single APK. I think it's other app's job such as Split APKs Installer. Those installer tools can install bundle APKs without modifying and re-signing.

Merging APKs is only required when patching a bundle APK.


@Mehlsine I think Antisplit-M sometime outputs a broken APK. If the merged APK is broken (Malformed ZIP entry), clear the app data of Antisplit-M and merge again will solves the problem. AbdurazaaqMohammed claims the APK is not corrupted, but that does not explain the inconsistent occurrence of Malformed ZIP entry errors.

This will be a reason why a reliable antisplit implementation is needed for revanced.

But this error could also be caused by the ReVanced Manager... I once had a Malformed ZIP entry error when I patched the Antisplit-M output APK with ReVanced Manager. However, after that, I tried patching again with the same apk, and no error was happened. So, this error possibly be caused by the ReVanced Manager. (randomly) But since then, I have not been able to reproduce the error.

AbdurazaaqMohammed commented 3 months ago

So, this error possibly be caused by the ReVanced Manager. (randomly)

Well, the same error in ReVanced happens with APKs merged by Apktool M, even thouigh Maximoff said he used apksig in Apktool M and it doesn't have this error, it also didn't have it when I tried with apksig, though I used MuntashirAkon's port for Android, so Maximoff said on 4pda he thinks it may be caused by something in ReVanced Manager

tilks (the developer of AntiSplit G2) said the problem is caused by ZIPDATADESCR for whatever reason, which can just be removed and is why signing the APK or modifying anything in MT Manager will fix it

Anyway, I added the option in AntiSplit M to fix it for ReVanced by rebuilding the APK, now it will work with no problem

oSumAtrIX commented 3 months ago

But this error could also be caused by the ReVanced Manager

ReVanced does not handle reading APK files. It uses apkzlib, the official Library to read .apk files according to spec which reports the issue. Any regular zip verifier will report the same issue.

OldManJenkins12 commented 3 months ago

To install a bundle APK, you don't have to merge it into a single APK. I think it's other app's job such as Split APKs Installer. Those installer tools can install bundle APKs without modifying and re-signing.

Merging APKs is only required when patching a bundle APK.

Oh alright, then there could be a "bundle installer" option on the bottom instead of "merger" for when people simply want to install a bundle/split apk

oSumAtrIX commented 3 months ago

If ReVanced implements split APK patching it will very likely not merge APKs but instead simply support the split architecture.