taku-nm / auto-cli

a simple script to automate the usage of revanced cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: patching reddit fails

N0amLevi opened this issue · comments

Trying to patch official reddit app with the deafult revanced patches this error is shown:

        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:123)
        at brut.androlib.AaptInvoker.invokeAapt(AaptInvoker.java:391)
        at app.revanced.patcher.data.ResourceContext.get(ResourceContext.kt:126)
        at app.revanced.patcher.Patcher.get(Patcher.kt:232)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:195)
        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:40)
Caused by: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\D38B~1\AppData\Local\Temp\brut_util_Jar_19612592089098953373924479425522182541.tmp, compile, --dir, C:\Users\נועם\Downloads\revanced-cli-output\revanced-resource-cache\res, --legacy, -o, C:\Users\נועם\Downloads\revanced-cli-output\revanced-resource-cache\build\resources.zip]
        at brut.util.OS.exec(OS.java:104)
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:119)
        ... 13 more

after the error is shown the done message apperas but no patched apk is in the revanced-cli-output folder.

Image

image

Since you used the custom option, I need the following:

  • Which version of the reddit app did you use
  • What patches did you use
  • What integrations did you use

reddit app version: 2023.37.0, 2023.36.0, 2023.30.0 (all of them didn't work)
Patches: no custom patches
integrations: no integrations

I tested 2023.37.0 from APKmirror, but I cannot reproduce your case...
Screenshot 2023-09-27 093818

Since you let auto-cli control all variables except the APK provided, I suspect that you gave it an APK that is somehow invalid or you might've given it an apkm.
Please use this exact version and try again:
https://www.apkmirror.com/apk/redditinc/reddit/reddit-2023-37-0-release/reddit-2023-37-0-2-android-apk-download/

I installed the exact version from the link but the error still occurs and the output folder is empty.

image

Please try using the 12th option in the app list now instead of custom. I've added reddit a few minutes ago

I tried, I get the exact same error.

Please send the full content of the cmd window
starting at the disclaimer at the top
use option 12 again

You can either mark all and copy paste it in here or stretch the window vertically and scroll to make multiple screenshots

Please send the full content of the cmd window starting at the disclaimer at the top use option 12 again

You can either mark all and copy paste it in here or stretch the window vertically and scroll to make multiple screenshots

The source APKs are downloaded from discord cdn. They originate from apkmirror.
The JDK in use is also downloaded from discord cdn. It originates from zulu JDK.
Every file's integrity can be checked using checksums.                                                                  If you wish to abort, close this window.                                                                                                                                                                                                        Press any key to continue . . .
  Script up-to-date   Version 1.37
  cURL found
  cURL integrity validated
  JDK found
  JDK integrity validated
  revanced-cli-3.1.0-all.jar validated
  revanced-patches-2.190.0.jar validated
  revanced-integrations-0.117.1.apk validated


  1. YouTube (Stock logo)
  2. YouTube (ReVanced logo)
  3. YouTube Music (compatible with Google Pixel)
  4. YouTube Music (compatible with other devices)
  5. TikTok
  6. Twitch
  7. Twitter
  8. Boost for Reddit
  9. Sync for Reddit
  10. Infinity for Reddit
  11. Relay for Reddit
  12. Reddit

  A. Custom

Type the number or letter to fetch the corresponding app and hit enter. 12
Downloading Reddit.apk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 76.5M  100 76.5M    0     0  16.9M      0  0:00:04  0:00:04 --:--:-- 16.9M
  Integrity validated Reddit.apk
Patching Reddit.apk
INFO: Loading patches
INFO: Setting patch options
INFO: Decoding app manifest
INFO: Change package name excluded by default
INFO: Enable android debugging excluded by default
INFO: Export all activities excluded by default
INFO: Override certificate pinning excluded by default
INFO: Predictive back gesture excluded by default
INFO: Remove screen capture restriction excluded by default
INFO: Remove screenshot restriction excluded by default
INFO: Spoof wifi connection excluded by default
INFO: Merging integrations
INFO: Deleting existing resource cache directory
INFO: Decoding resources
INFO: Executing patches
INFO: Disable screenshot popup succeeded
INFO: Hide ads succeeded
INFO: Premium icon reddit succeeded
INFO: Sanitize sharing links succeeded
INFO: Compiling modified dex files
INFO: Compiling modified resources
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\D38B~1\AppData\Local\Temp\brut_util_Jar_89683455915060902355401732355464071309.tmp, compile, --dir, C:\Users\נועם\Downloads\revanced-cli-output\revanced-resource-cache\res, --legacy, -o, C:\Users\נועם\Downloads\revanced-cli-output\revanced-resource-cache\build\resources.zip]
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:123)
        at brut.androlib.AaptInvoker.invokeAapt(AaptInvoker.java:391)
        at app.revanced.patcher.data.ResourceContext.get(ResourceContext.kt:126)
        at app.revanced.patcher.Patcher.get(Patcher.kt:232)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:195)
        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:40)
Caused by: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\D38B~1\AppData\Local\Temp\brut_util_Jar_89683455915060902355401732355464071309.tmp, compile, --dir, C:\Users\נועם\Downloads\revanced-cli-output\revanced-resource-cache\res, --legacy, -o, C:\Users\נועם\Downloads\revanced-cli-output\revanced-resource-cache\build\resources.zip]
        at brut.util.OS.exec(OS.java:104)
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:119)
        ... 13 more

  DONE
  Transfer the PATCHED app found in the revanced-cli-output folder to your phone and open to the apk to install it

 If something goes wrong, screenshot the ENTIRE terminal in your support request in the ReVanced discord support channel.
 bat Version 1.37

 Backups, keystore and supporting files can be found in AppData\Local\revanced-cli
  To use the backup files, rename them to .apk instead of .backup

 Pressing any key will close this window.

Press any key to continue . . .

Okay, two last steps for debugging:

  • Go into Appdata/local/revanced-cli/keystore and delete every keystore that is called patched_reddit.keystore
  • Try again

If it still fails after that, change the install location by editing line 9 in the script. (Right click to edit)
by default it is set "localappdata=%localappdata%"
change it to set "localappdata=C:\Program Files"

There are no keystores at all So I skipped to changing the install location. I do get the same error which I suppose shouldn't be there but I do get an apk in the output folder.

The reddit.apk you get is unpatched, since the patching fails, you don't get the patched_reddit.apk

I'm working on it
Can you give me your system specs, including OS?

Processor Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz 2.30 GHz
Installed RAM 8.00 GB (7.84 GB usable)
GPU NVIDIA GeForce MX330
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display

OS:
Edition Windows 11 Home
Version 22H2
OS build 22621.2283
Experience Windows Feature Experience Pack 1000.22662.1000.0

does patching any other app work?
try YouTube music

does patching any other app work? try YouTube music

There is a file in the output folder but I still get the error.

Okay, I noticed that the Appdata is in user dir:
C:\Users\D38B~1\AppData\Local\
but you're executing the script in
C:\Users\נועם\Downloads\

How come the user directory doesn't match? Is this because of the non-latin characters in your username?

to test this please try executing the script at a different location like
C:\Program Files\ or any other directory in which you have read and write permissions in and the path to it doesn't contain non-latin characters.
The script will create a new revanced-cli-output folder at which ever location you're running it in.

Hey there, I've noticed that your user folder contains very weird non-standard characters. I highly recommend creating a new Windows user with normal ASCII (A to Z, 0 to 9) characters and run the script on that user instead.

Since you've already changed the install location, once you move the script to a location as described earlier, please send the log if something goes wrong after that.

Hey there, I've noticed that your user folder contains very weird non-standard characters. I highly recommend creating a new Windows user with normal ASCII (A to Z, 0 to 9) characters and run the script on that user instead.

Yes, that was my assumption so earlier I ran the script with no problems on a new windows user. I just came here to write that and saw your suggestion. The "wierd" characters are hebrew letters.

While I did manage to find a solution, I am doing more in depth research about the error to see if there's a way to fix it so I can use my main user and if the "wierd" characters really are the problem.

This appears to be an issue with AAPT not handling non-latin characters all that well. Given that its not related to this script, nor revanced cli, you could maybe try reporting it to those responsible for it.