revanced-patches-template icon indicating copy to clipboard operation
revanced-patches-template copied to clipboard

bug: Error while adding `summary` to `ListPreference`

Open johnconner122 opened this issue 2 years ago • 1 comments

Type

Error while patching

Bug description

Add summary to ListPreference:

                 ListPreference(
                    "revanced_default_video_quality_wifi",
                    StringResource("revanced_default_video_quality_wifi_title", "Change video quality on Wi-Fi network"),
                    entries = ArrayResource("revanced_video_quality_wifi_entries", keys),
                    entryValues = ArrayResource("revanced_video_quality_wifi_entry_values", values),
                    default = values[0].value,
                    summary = StringResource("revanced_default_video_quality_wifi_summary", keys[0].value)
                    ),
                ListPreference(
                    "revanced_default_video_quality_mobile",
                    StringResource("revanced_default_video_quality_mobile_title", "Change video quality on Mobile network"),
                    entries = ArrayResource("revanced_video_quality_mobile_entries", keys),
                    entryValues = ArrayResource("revanced_video_quality_mobile_entry_values", values),
                    default = values[0].value,
                    summary = StringResource("revanced_default_video_quality_mobile_summary", keys[0].value)
                )

it will generate error

Steps to reproduce

  1. Implement ListPreference in a patch.
  2. Remember to add summary to list preference
  3. It'll generate resource not found error

Relevant log output

WARNING: D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\res\xml\revanced_prefs.xml:2: error: resource string/revanced_default_video_quality_wifi_summary (aka app.revanced.android.youtube:string/revanced_default_video_quality_wifi_summary) not found.
WARNING: D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\res\xml\revanced_prefs.xml:2: error: resource string/revanced_default_video_quality_mobile_summary (aka app.revanced.android.youtube:string/revanced_default_video_quality_mobile_summary) not found.
WARNING: error: failed linking file resources.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Rizwan\AppData\Local\Temp\brut_util_Jar_118829810385967026017310832917275353658.tmp, link, -o, D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\aapt_temp_file, --min-sdk-version, 26, --target-sdk-version, 33, --version-code, 1535632832, --version-name, 18.03.36, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, -e, C:\Users\Rizwan\AppData\Local\Temp\APKTOOL6272651368612361753.tmp, -0, arsc, -I, revanced-cache\1.apk, --manifest, D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\AndroidManifest.xml, D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\build\resources.zip]
        at brut.androlib.res.AndrolibResources.aapt2Package(AndrolibResources.java:484)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:619)
        at app.revanced.patcher.Patcher.save(Patcher.kt:144)
        at app.revanced.cli.patcher.Patcher.start$revanced_cli(Patcher.kt:22)
        at app.revanced.cli.command.MainCommand.run(MainCommand.kt:152)
        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.main.MainKt.main(Main.kt:7)
Caused by: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Rizwan\AppData\Local\Temp\brut_util_Jar_118829810385967026017310832917275353658.tmp, link, -o, D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\aapt_temp_file, --min-sdk-version, 26, --target-sdk-version, 33, --version-code, 1535632832, --version-name, 18.03.36, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, -e, C:\Users\Rizwan\AppData\Local\Temp\APKTOOL6272651368612361753.tmp, -0, arsc, -I, revanced-cache\1.apk, --manifest, D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\AndroidManifest.xml, D:\Softwares\Apps & Softwares\Android\Android Apps\Revanced\revanced-cache\build\resources.zip]
        at brut.util.OS.exec(OS.java:99)
        at brut.androlib.res.AndrolibResources.aapt2Package(AndrolibResources.java:480)
        ... 13 more

Screenshots or videos

No response

Solution

No response

Additional context

No response

Acknowledgements

  • [X] I have searched the existing issues and this is a new and no duplicate or related to another open issue.
  • [X] I have written a short but informative title.
  • [X] I filled out all of the requested information in this issue properly.

johnconner122 avatar Feb 26 '23 08:02 johnconner122