ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.55k stars 294 forks source link

bug(Reddit): Failed to patch Reddit v2024.18.0+ #3099

Open cyberboh opened 6 months ago

cyberboh commented 6 months ago

Bug description

After reddit updated to v2024.18.0, its fail to be patched. Was work on previous Reddit 2024.17.0 Using CLI 4.6.0 with default patches selected.

java -jar revanced-cli-4.6.0-all.jar patch -p -o Install\Reddit_2024.18.0-all_ReVanced.apk --options options.json -b revanced-patches-4.8.0-dev.9.jar --keystore-entry-alias=****** --keystore-password=****** --keystore-entry-password=****** --keystore=******.keystore -m revanced-integrations-1.9.0-dev.6.apk Apps\com.reddit.frontpage-2024.18.0-all.apk

Error logs

WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\res\values\styles.xml:2661: error: expected enum but got (raw string) 0.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\res\values\styles.xml:3268: error: expected enum but got (raw string) 1.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\res\values\styles.xml:3271: error: expected enum but got (raw string) 1.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\res\values\styles.xml:3303: error: expected enum but got (raw string) 1.
WARNING: error: failed linking references.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\User\AppData\Local\Temp\brut_util_Jar_160464020939428848823309772031326134023.tmp, link, -o, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\patched\resources\resources.apk, --package-id, 127, --min-sdk-version, 26, --target-sdk-version, 34, --version-code, 1577901, --version-name, 2024.18.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --warn-manifest-validation, -e, C:\Users\User\AppData\Local\Temp\APKTOOL7857465341792012760.tmp, -0, arsc, -I, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\1.apk, --manifest, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\AndroidManifest.xml, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\build\resources.zip]
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:249)
        at brut.androlib.AaptInvoker.invokeAapt(AaptInvoker.java:394)
        at app.revanced.patcher.data.ResourceContext.get(ResourceContext.kt:134)
        at app.revanced.patcher.Patcher.get(Patcher.kt:268)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:312)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at app.revanced.cli.command.MainCommandKt.main(MainCommand.kt:12)
Caused by: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\User\AppData\Local\Temp\brut_util_Jar_160464020939428848823309772031326134023.tmp, link, -o, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\patched\resources\resources.apk, --package-id, 127, --min-sdk-version, 26, --target-sdk-version, 34, --version-code, 1577901, --version-name, 2024.18.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --warn-manifest-validation, -e, C:\Users\User\AppData\Local\Temp\APKTOOL7857465341792012760.tmp, -0, arsc, -I, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\1.apk, --manifest, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\AndroidManifest.xml, E:\ANDROID\APPS\ReVanced\Patched\Install\Reddit_2024.18.0-all_ReVanced-temporary-files\patcher\apk\build\resources.zip]
        at brut.util.OS.exec(OS.java:104)
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:245)
        ... 13 more

Solution

No response

Additional context

No response

Acknowledgements

oSumAtrIX commented 6 months ago

Since AAPT is failing this is something that can't be fixed unless it's fixed in the resource decoder of Androlib of AAPT. The only thing this repository can do is to constrain to the last working version until the former is done

cyberboh commented 6 months ago

Since AAPT is failing this is something that can't be fixed unless it's fixed in the resource decoder of Androlib of AAPT. The only thing this repository can do is to constrain to the last working version until the former is done

Who can fix AAPT issues? Google themself?

Anyway, 2024.17.0 is last working version.

inotia00 commented 6 months ago

The related issue is https://github.com/iBotPeaches/Apktool/issues/3534, and I don't think it will be possible to fix it for some time.

Maybe implementing arsc-lib might be a solution.

Anyway, in order to avoid user confusion, it is better for Reddit to limit the supported versions.

omega59 commented 6 months ago

Hi, yes it fails after step 12 classes.dex

Xisrr1 commented 6 months ago

So will this issue ever be solved?

ascopes commented 6 months ago

Can the patches be updated to recommend the last working version within the Revanced Manager app? Right now it says "any version" which isn't reflective of what is supported unfortunately.

Had to do some digging to find this thread... some other people who are not as fluent with GitHub might struggle! 🙂

Xisrr1 commented 6 months ago

Can the patches be updated to recommend the last working version within the Revanced Manager app? Right now it says "any version" which isn't reflective of what is supported unfortunately.

Had to do some digging to find this thread... some other people who are not as fluent with GitHub might struggle! 🙂

It is restricted for me on RVX

ascopes commented 6 months ago

Am I looking at the wrong thing in that case? I reinstalled the manager 10 minutes before commenting here

Screenshot_2024-05-11-21-50-43-86_a85b47aaa863e3bc831e16d29c27a79c

oSumAtrIX commented 6 months ago

Feel free to open a PR. Only resource patches need to be constrained.

ascopes commented 6 months ago

Will see if I can get some time tomorrow to try and work out what I need to change and how!

rufftruffles commented 6 months ago

Any update on this?

gui-lherme commented 5 months ago

Can confirm. Tried to patch latest version of Reddit apk today (2024.22.1) and got the error message bellow:

pranayadmn commented 4 months ago

After catching up with https://github.com/iBotPeaches/Apktool/issues/3534#issuecomment-2194478917, I thought of trying recent versions of Reddit to see if they actually bumped the Gradle version which fixes the issue. Indeed, new versions of Reddit can be compiled fine now but some patches fail to be applied which is kinda expected due to the long version freeze.

- Device Info
ReVanced Manager: 1.20.1
Model: A142
Android version: 14
Supported architectures: arm64-v8a, armeabi-v7a, armeabi
Root permissions: Yes

- Patch Info
App: com.reddit.frontpage v2024.29.0 (Suggested: 2024.17.0)
Patches version: v4.11.0
Patches added: Default
Patches removed: Disable screenshot popup
Default patch options changed: None

- Settings
Allow changing patch selection: true
Version compatibility check: false
Show universal patches: false
Patches source: revanced/revanced-patches
Integration source: revanced/revanced-integrations

- Logs
Reading APK
Decoding app manifest
Loading patches
Merging integrations
Deleting existing temporary files directory
Decoding resources
Executing patches
Hide ads failed: app.revanced.patcher.patch.PatchException: 'Hide ads' depends on 'HideCommentAdsPatch' that raised an exception:
app.revanced.patcher.patch.PatchException: Failed to resolve HideCommentAdsFingerprint
    at app.revanced.util.BytecodeUtilsKt.getException(BytecodeUtils.kt:27)
    at app.revanced.patches.reddit.ad.comments.HideCommentAdsPatch.execute(HideCommentAdsPatch.kt:21)
    at app.revanced.patches.reddit.ad.comments.HideCommentAdsPatch.execute(HideCommentAdsPatch.kt:10)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend$executePatch(Unknown Source:190)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend$executePatch(Unknown Source:91)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Unknown Source:292)
    at app.revanced.patcher.Patcher$apply$1.invoke(SourceFile:0)
    at app.revanced.patcher.Patcher$apply$1.invoke(SourceFile:0)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Unknown Source:2)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Unknown Source:71)
    at app.revanced.manager.flutter.MainActivity$runPatcher$1$patcherResult$1$2.invokeSuspend(Unknown Source:76)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
    at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(Unknown Source:46)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Unknown Source:23)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Unknown Source:73)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:0)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Unknown Source:6)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:0)
    at app.revanced.manager.flutter.MainActivity.runPatcher$lambda$34(Unknown Source:470)
    at app.revanced.manager.flutter.MainActivity.$r8$lambda$hTJfH-rv2j-9Y91G5H_L5jFDN6U(SourceFile:0)
    at app.revanced.manager.flutter.MainActivity$$ExternalSyntheticLambda5.run(SourceFile:0)
    at java.lang.Thread.run(Thread.java:1012)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend$executePatch(Unknown Source:148)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Unknown Source:292)
    at app.revanced.patcher.Patcher$apply$1.invoke(SourceFile:0)
    at app.revanced.patcher.Patcher$apply$1.invoke(SourceFile:0)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Unknown Source:2)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Unknown Source:71)
    at app.revanced.manager.flutter.MainActivity$runPatcher$1$patcherResult$1$2.invokeSuspend(Unknown Source:76)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
    at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(Unknown Source:46)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Unknown Source:23)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Unknown Source:73)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:0)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Unknown Source:6)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:0)
    at app.revanced.manager.flutter.MainActivity.runPatcher$lambda$34(Unknown Source:470)
    at app.revanced.manager.flutter.MainActivity.$r8$lambda$hTJfH-rv2j-9Y91G5H_L5jFDN6U(SourceFile:0)
    at app.revanced.manager.flutter.MainActivity$$ExternalSyntheticLambda5.run(SourceFile:0)
    at java.lang.Thread.run(Thread.java:1012)
Sanitize sharing links failed: app.revanced.patcher.patch.PatchException: Failed to resolve ShareLinkFormatterFingerprint
    at app.revanced.util.BytecodeUtilsKt.getException(BytecodeUtils.kt:27)
    at app.revanced.patches.reddit.misc.tracking.url.SanitizeUrlQueryPatch.execute(SanitizeUrlQueryPatch.kt:24)
    at app.revanced.patches.reddit.misc.tracking.url.SanitizeUrlQueryPatch.execute(SanitizeUrlQueryPatch.kt:12)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend$executePatch(Unknown Source:190)
    at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Unknown Source:292)
    at app.revanced.patcher.Patcher$apply$1.invoke(SourceFile:0)
    at app.revanced.patcher.Patcher$apply$1.invoke(SourceFile:0)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Unknown Source:2)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Unknown Source:71)
    at app.revanced.manager.flutter.MainActivity$runPatcher$1$patcherResult$1$2.invokeSuspend(Unknown Source:76)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
    at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(Unknown Source:46)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Unknown Source:23)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Unknown Source:73)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:0)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Unknown Source:6)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:0)
    at app.revanced.manager.flutter.MainActivity.runPatcher$lambda$34(Unknown Source:470)
    at app.revanced.manager.flutter.MainActivity.$r8$lambda$hTJfH-rv2j-9Y91G5H_L5jFDN6U(SourceFile:0)
    at app.revanced.manager.flutter.MainActivity$$ExternalSyntheticLambda5.run(SourceFile:0)
    at java.lang.Thread.run(Thread.java:1012)
Applied 1 patches
Compiling patched dex files
Compiled 12 dex files
Compiling modified resources
Aligning APK
Signing APK
Patched APK
oSumAtrIX commented 4 months ago

Did you check if the recent couple versions work again or just that version.

pranayadmn commented 4 months ago

Did you check if the recent couple versions work again or just that version.

I did, it seems like 2024.26.1 is the last version that has the AAPT error and the versions since 2024.28.0 can be compiled fine.

cyberboh commented 4 months ago

The huge issue now is, apkmirror will not provided full apk anymore, e.g recent X/Twitter , Tumblr and Reddit. Only bundled apk are available. For CLI users like me is dissappointed bcs of it.

rywz commented 3 months ago

The huge issue now is, apkmirror will not provided full apk anymore, e.g recent X/Twitter , Tumblr and Reddit. Only bundled apk are available. For CLI users like me is dissappointed bcs of it.

You can use AntiSplit-M to merge split APKs.

omega59 commented 3 months ago

The apk is a avaliable for beta YT. Unless I miss understanding what you mean. But I just searched.

OldManJenkins12 commented 3 months ago

The huge issue now is, apkmirror will not provided full apk anymore, e.g recent X/Twitter , Tumblr and Reddit. Only bundled apk are available. For CLI users like me is dissappointed bcs of it.

You can use AntiSplit-M to merge split APKs.

AntiSplit-M will result in an error upon patching, specifically at the end of patching (revanced manager), because of this perhaps revanced manager should accept split/bundle apk's, by merging them first, then patching them

rywz commented 3 months ago

The huge issue now is, apkmirror will not provided full apk anymore, e.g recent X/Twitter , Tumblr and Reddit. Only bundled apk are available. For CLI users like me is dissappointed bcs of it.

You can use AntiSplit-M to merge split APKs.

AntiSplit-M will result in an error upon patching, specifically at the end of patching (revanced manager), because of this perhaps revanced manager should accept split/bundle apk's, by merging them first, then patching them

You can use the same developer's Revanced Manager version, which fixes this problem.

OldManJenkins12 commented 3 months ago

The huge issue now is, apkmirror will not provided full apk anymore, e.g recent X/Twitter , Tumblr and Reddit. Only bundled apk are available. For CLI users like me is dissappointed bcs of it.

You can use AntiSplit-M to merge split APKs.

AntiSplit-M will result in an error upon patching, specifically at the end of patching (revanced manager), because of this perhaps revanced manager should accept split/bundle apk's, by merging them first, then patching them

You can use the same developer's modified Revanced Manager version which fixes this problem

Yes you could, however for most users this option isn't desirable, they would rather use the official manager, and it's better to implement a fix to the problem to the official manager

oSumAtrIX commented 3 months ago

The issue is not caused or originates at ReVanced. ReVanced expects a working APK file, your tool above spits out a corrupted one. Please solve that with the developers of that tool.

OldManJenkins12 commented 3 months ago

The issue is not caused or originates at ReVanced. ReVanced expects a working APK file, your tool above spits out a corrupted one. Please solve that with the developers of that tool.

I think it would be better for the manager to merge bundle/split apk's (accepting them) and then patching it, this way there's no need to use the tool at all, which means to most users, a better UX. And with revanced manager doing this on its own (merging) it can mitigate this issue

oSumAtrIX commented 3 months ago

Splits are unsupported, would need significant changes and is unrelated to this issue. Supply a working APK file

rywz commented 3 months ago

Supply a working APK file

The thing you don't understand is, Google no longer provides "normal" APKs for X, Reddit etc., provides only the bundled ones.

oSumAtrIX commented 3 months ago

I absolutely do understand and like i said, ReVanced requires an APK file. How you wanna do that is your concern until, if at all, we consider split support which is unrelated to this issue.

rywz commented 3 months ago

I absolutely do understand and like i said, ReVanced requires an APK file. How you wanna do that is your concern until, if at all, we consider split support which is unrelated to this issue.

We can get an APK file using AntiSplit-M but like @OldManJenkins12 and another user reported an error will occur while trying to patch it saying the file is corrupted, which is not and will perfectly work as expected after patching & installing.

This is something Revanced can fix, but if you won't, the only option is to use modified Revanced Manager

oSumAtrIX commented 3 months ago

The fork modifies the ZIP spec to an invalid one so i lt bypasses the invalid CRC in the corrupted APK file. As I said, ReVanced Manager expects a working APK file

rywz commented 3 months ago

The fork modifies the ZIP spec to an invalid one so i lt bypasses the invalid CRC in the corrupted APK file. As I said, ReVanced Manager expects a working APK file

It's not corrupted though. It works perfectly without any issues/crashes, like a working APK file you're stating.

omega59 commented 3 months ago

This has gone in circles of "provide a working apk" to "it is working just manager doesn't support." Bottom line, they don't want to implement a-ll-in-one solution that will re-merge the apk package into a single file required "working."

oSumAtrIX commented 3 months ago

No, I already explained clearly that the CRC is wrong in your APK. It is a corrupted APK file and just because the APK runs doesn't mean it is not broken.