Repository navigation
fix(install): make InstallError.code the reason code alone, and quote the apk path with '!' - #598
Merged
Merged
Conversation
Newer Android prints a failed install as Failure [INSTALL_FAILED_X: description], and the error's code was the whole bracket text, so a check such as code === 'INSTALL_FAILED_UPDATE_INCOMPATIBLE' never matched. The code is now the part before the first colon. The error's message still holds the full text, description included. The old Failure [INSTALL_FAILED_X] form gives the same code as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Karol Wrótniak <[email protected]>
installRemote() quoted the apk path with _escapeCompat(), which turns
'!' into '\!'. The device's shell keeps the backslash, so pm looked for
bang\!A.apk instead of bang!A.apk and failed with "Can't open file".
Use _escape(), as the other arguments already do. Checked on an Android
16 emulator: before, installRemote('/data/local/tmp/bang!A.apk') rejected
with INSTALL_EXCEPTION; after, it installs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Karol Wrótniak <[email protected]>
koral--
added a commit
to mdub1na/stf
that referenced
this pull request
Nov 24, 2026
…IBLE Installing an app signed with another key than the installed one is supposed to uninstall the app and install again. The retry only checked INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES, the code of old Android versions. Modern Android reports INSTALL_FAILED_UPDATE_INCOMPATIBLE, so the install failed with that message and the retry never ran. Add the code to the retry. The uninstall wipes the app's data, as it did before. This needs an adbkit release that sets InstallError.code to the reason code alone (DeviceFarmer/adbkit#598). Until the dependency is bumped, modern Android still reports the code with its description and the retry does not trigger. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small fixes in
install/installRemote, one commit each.1.
InstallError.codeis the reason code aloneModern Android prints a failed install as
Failure [INSTALL_FAILED_X: description]. The error'scodewas the whole bracket text, soerr.code === 'INSTALL_FAILED_UPDATE_INCOMPATIBLE'never matched; callers had to strip the description themselves.codeis now the part before the first:(INSTALL_FAILED_UPDATE_INCOMPATIBLE).messagestill holds the full text, description included.Failure [INSTALL_FAILED_X](no colon) gives the same code as before.Behavior change: code that matched the old long string now sees only the short code. Exact and
startsWithchecks on the short code both work.2. Single-quote the apk path (
!escape)installRemote()quoted the apk path with_escapeCompat(), which turns!into\!. The device shell keeps the backslash, sopmwas givenbang\!A.apk. It now uses_escape(), like the other arguments ('...').Tested
npm run lint,npm test(398 passing).err.code === 'INSTALL_FAILED_UPDATE_INCOMPATIBLE', anderr.messageis... could not be installed [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package ... signatures do not match newer version; ignoring!].installRemote('/data/local/tmp/bang!A.apk'): before,INSTALL_EXCEPTION ... Can't open file: /data/local/tmp/bang\!A.apk; after, it installs.🤖 Generated with Claude Code