ReVanced / revanced-patches

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

bug: AddResourcesPatch search in strange paths #2998

Closed EnricoTirri closed 5 months ago

EnricoTirri commented 5 months ago

Bug description

Using patcher-cli with modified temp-files dir, AddResourcesPatch search for resources in strange ripetitive path. Step to reproduce: java -jar revanced-cli.jar patch -b <path_to/patches.jar> -m <path_to/integrations.apk> -o ./out/test.apk -t ./out/temp/ <path_to/app.apk>

Error logs

INFO: Loading patches 
INFO: Decoding app manifest 
INFO: Spoof Wi-Fi connection excluded 
INFO: Remove screenshot restriction excluded
INFO: Remove screen capture restriction excluded
INFO: Export all activities excluded
INFO: Enable Android debugging excluded
INFO: Override certificate pinning excluded
INFO: Hex excluded
INFO: Change package name excluded
INFO: Spoof SIM country excluded
INFO: Predictive back gesture excluded
INFO: Remove player controls background excluded
INFO: Custom branding excluded
INFO: Change header excluded
INFO: Enable slide to seek excluded
INFO: Setting patch options
INFO: Merging integrations 
INFO: Deleting existing temporary files directory 
INFO: Decoding resources
INFO: Executing patches 
INFO: Alternative thumbnails succeeded 
INFO: Always repeat succeeded 
INFO: Announcements succeeded 
INFO: Bypass URL redirects succeeded 
INFO: Change start page succeeded 
INFO: Client spoof succeeded 
INFO: Comments succeeded 
INFO: Copy video URL succeeded 
INFO: Custom player overlay opacity succeeded
INFO: Disable auto captions succeeded 
INFO: Disable fullscreen ambient mode succeeded 
INFO: Disable player popup panels succeeded
INFO: Disable precise seeking gesture succeeded 
INFO: Disable resuming Shorts on startup succeeded 
INFO: Disable rolling number animations succeeded
INFO: Disable suggested video end screen succeeded 
INFO: Disable zoom haptics succeeded
INFO: Downloads succeeded 
INFO: Enable debugging succeeded
INFO: Enable tablet layout succeeded
INFO: GmsCore support succeeded 
INFO: Hide Shorts components succeeded 
INFO: Hide ads succeeded 
INFO: Hide album cards succeeded 
INFO: Hide autoplay button succeeded
INFO: Hide captions button succeeded
INFO: Hide cast button succeeded
INFO: Hide crowdfunding box succeeded 
INFO: Hide endscreen cards succeeded 
INFO: Hide filter bar succeeded 
INFO: Hide floating microphone button succeeded 
INFO: Hide info cards succeeded
INFO: Hide layout components succeeded 
INFO: Hide player buttons succeeded
INFO: Hide seekbar succeeded 
INFO: Hide timestamp succeeded 
INFO: Hide video action buttons succeeded
INFO: Minimized playback succeeded 
INFO: Navigation buttons succeeded
INFO: Open links externally succeeded 
INFO: Playback speed succeeded 
INFO: Player flyout menu succeeded
INFO: Remember video quality succeeded 
INFO: Remove tracking query parameter succeeded 
INFO: Remove viewer discretion dialog succeeded
INFO: Restore old seekbar thumbnails succeeded
INFO: Restore old video quality menu succeeded
INFO: Return YouTube Dislike succeeded 
INFO: Seekbar tapping succeeded
INFO: SponsorBlock succeeded 
INFO: Spoof app version succeeded
INFO: Spoof device dimensions succeeded 
INFO: Swipe controls succeeded 
INFO: Tablet mini player succeeded 
INFO: Theme succeeded 
INFO: Video ads succeeded
INFO: Wide searchbar succeeded 
INFO: Change package name succeeded
SEVERE: null failed:
app.revanced.patcher.patch.PatchException: 'AddResourcesPatch' raised an exception while being closed: app.revanced.patcher.patch.PatchException: .\out\temp\patcher\apk\.\out\temp\patcher\apk\res\values\strings.xml (Impossible to find specified path)
        at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Patcher.kt:234)
        at app.revanced.patcher.Patcher$apply$1.invoke(Patcher.kt)
        at app.revanced.patcher.Patcher$apply$1.invoke(Patcher.kt)
        at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
        at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
        at app.revanced.cli.command.PatchCommand$run$4$1$1.invokeSuspend(PatchCommand.kt:303)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:302)
        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: java.io.FileNotFoundException: .\out\temp\patcher\apk\.\out\temp\patcher\apk\res\values\strings.xml (Impossible to find specified path)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
        at app.revanced.patcher.util.Document.<init>(Document.kt:21)
        at app.revanced.patcher.util.DomFileEditor.<init>(DomFileEditor.kt:18)
        at app.revanced.patcher.data.ResourceContext$XmlFileHolder.get(ResourceContext.kt:257)
        at app.revanced.patches.all.misc.resources.AddResourcesPatch.close$invoke(AddResourcesPatch.kt:263)
        at app.revanced.patches.all.misc.resources.AddResourcesPatch.close(AddResourcesPatch.kt:285)
        at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Patcher.kt:228)
        ... 23 more

        at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Patcher.kt:241)
        at app.revanced.patcher.Patcher$apply$1.invoke(Patcher.kt)
        at app.revanced.patcher.Patcher$apply$1.invoke(Patcher.kt)
        at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
        at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
        at app.revanced.cli.command.PatchCommand$run$4$1$1.invokeSuspend(PatchCommand.kt:303)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:302)
        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: app.revanced.patcher.patch.PatchException: .\out\temp\patcher\apk\.\out\temp\patcher\apk\res\values\strings.xml (Impossibile trovare il percorso specificato)
        at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Patcher.kt:234)
        ... 23 more
Caused by: java.io.FileNotFoundException: .\out\temp\patcher\apk\.\out\temp\patcher\apk\res\values\strings.xml (Impossible to find specified path)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
        at app.revanced.patcher.util.Document.<init>(Document.kt:21)
        at app.revanced.patcher.util.DomFileEditor.<init>(DomFileEditor.kt:18)
        at app.revanced.patcher.data.ResourceContext$XmlFileHolder.get(ResourceContext.kt:257)
        at app.revanced.patches.all.misc.resources.AddResourcesPatch.close$invoke(AddResourcesPatch.kt:263)
        at app.revanced.patches.all.misc.resources.AddResourcesPatch.close(AddResourcesPatch.kt:285)
        at app.revanced.patcher.Patcher$apply$1.invokeSuspend(Patcher.kt:228)
        ... 23 more

INFO: Compiling patched dex files 
INFO: Compiled classes.dex 
INFO: Compiled classes2.dex 
INFO: Compiled classes3.dex 
INFO: Compiled classes4.dex 
INFO: Compiled classes5.dex 
INFO: Compiled classes6.dex 
INFO: Compiled classes7.dex 
INFO: Compiled classes8.dex 
INFO: Compiling modified resources 
...

Solution

No response

Additional context

revanced_cli version : 4.6.0 revanced_patches version : 4.7.0 revanced_integrations version : 1.8.0 jdk version : 11.0.2 OS : Windows 10

Acknowledgements

oSumAtrIX commented 5 months ago

Please add all information properly, including versions and environmental information like space

EnricoTirri commented 5 months ago

I've updated with as much information as I could, the only thing that I haven't inserted is "space" because I don't understand what you meant. I've updated all the log info because I've tried with the latest version of everything and things haven't changed I'd like to fix things myself and make a pull request but I don't know which patch is this problem referred to, so I don't know neither where to start, I hope you can fix it

cyberboh commented 5 months ago

He mean storage are left in your drive. Personally tested -t parameter working fine in my machine. Could be the issue is from exact path you put on.

EnricoTirri commented 5 months ago

I've at least 50Gb of free space, I think it isn't the problem. I've tried with a absolute path and not a relative one ( ./path) and is seems working, problem with relative path still exists. @cyberboh have you tried too with a relative path?

cyberboh commented 5 months ago

I've at least 50Gb of free space, I think it isn't the problem. I've tried with a absolute path and not a relative one ( ./path) and is seems working, problem with relative path still exists. @cyberboh have you tried too with a relative path?

Relative path does not work here Maybe it's bug on CLI

EnricoTirri commented 5 months ago

In case this could be a problem of CLI can you tell me which patch "AddResourcePatch" is referred to? because I'm not able to find it. (I want to try to find out where is the problem)

cyberboh commented 5 months ago

In case this could be a problem of CLI can you tell me which patch "AddResourcePatch" is referred to? because I'm not able to find it. (I want to try to find out where is the problem)

Maybe this https://github.com/ReVanced/revanced-patches/blob/main/src/main/kotlin/app/revanced/patches/all/misc/resources/AddResourcesPatch.kt

EnricoTirri commented 5 months ago

Perfect, thanks

oSumAtrIX commented 5 months ago

The error is here Caused by: java.io.FileNotFoundException: .\out\temp\patcher\apk.\out\temp\patcher\apk\res\values\strings.xml (Impossible to find specified path)

It looks like a CLI issue. Please reopen in its repository