Lauriethefish/QuestPatcher

Never finishes patching step 5/5 "Installing modded APK"

Closed this issue · 4 comments

YorVeX commented

I am trying to patch Beat Saber 1.28, but the last step "Installing Modded APK" is never finished. SideQuest takes 10-15 seconds to install the normal Beat Saber APK, I waited 20 minutes but QuestPatcher just doesn't progress anymore and is probably stuck at this step forever:
image

Windows 10 Pro. Installed QuestPatcher through WinGet if that matters.

The log on disk shows these last lines:

[2023-04-10 03:15:52 INF] Installing the modded APK . . .
[2023-04-10 03:15:52 DBG] Executing ADB command: adb install "C:\Users\YorVeX\AppData\Local\Temp\QuestPatcher\patching\patched.apk"

I can also see that adb is running and holds a lock on this file.

Tried the whole process several times (restarting everything and reinstalling Beat Saber between attempts) but the problem stays the same.

YorVeX commented

Killed adb.exe and installed the patched apk file with SideQuest, which took the usual 10-15 seconds and worked fine. Maybe my adb is broken?

We have seen a similar issue in the Chinese fork that adb install sometimes takes forever to finish. Upload the apk then install via adb pm install should solve the issue.

We added a config option for this.

        public async Task InstallApp(string apkPath, bool copyFirst)
        {
            if (copyFirst)
            {
                const string destApkPath = @"/data/local/tmp/tmp.apk";
                await UploadFile(apkPath, destApkPath);
                await RunCommand($"shell pm install {destApkPath}");
            }
            else
            {
                await RunCommand($"install \"{apkPath}\"");
            }
        }

https://github.com/MicroCBer/QuestPatcher/blob/da0959b7516c875df1fd7b3b3f3764a2acd8a1ef/QuestPatcher.Core/AndroidDebugBridge.cs#L281-L293

You can also specify --no-streaming and ADB will do this for you.

This is an ADB issue, I might make QP timeout if installing the APK takes too long, then try the other method.

YorVeX commented

I guess that makes the most sense, QP cannot do anything about the broken ADB but maybe the current error handling can be improved.

In this situation I can close it and it correctly shows a warning about leaving corrupted data behind, but what can I do but still confirm? Then it didn't exactly leave corrupted data (the APK was fine and could be installed manually, I already played BS with no issues since then) but it left a "corrupted state", after restarting QP it showed a file access exception message to that APK and just closes again. Maybe it could check whether ADB is still running, kill it and clean up all data it left behind? Except the modded APK, which can be either used in an alternative installation attempt by QP or the user could be pointed towards its location for manual install.